【已解决】关于低功耗产品mqtt上线前的不同DNS对上线时间的影响
1、测试发现mqtt上线前的日志中发现当第一次443访问失败后,
[18:51:48:218][01-01 08:00:13-- TUYA Err][http_inf.c:47] Open session failed: https://h2.iot-dns.com/v1/dns_query (-7)
[18:51:48:233][01-01 08:00:13-- TUYA Err][tuya_iot_com_api.c:138] custom dns fail.m2.tuyacn.com
[18:51:48:244][01-01 08:00:13-- TUYA Err][mqtt_client.c:1149] resolve mqtt host Fail:m2.tuyacn.com erro:-102
sdk内部好像处理使用了本地 system DNS,后续唤醒使用本地DNS比 tuya static DNS速度更快, 出图时间更快,这是什么原因呢?见 test.log
使用system DNS的日志, 见test.log
[18:52:43:217]|105241.602 MAIN 114 | App Start 系统启动
[18:52:44:249]|105242.445 TUYA 275 | Set g_mo_wifi_status ======================== 1 连网完成
[18:52:44:284]unw_gethostbyname m2.tuyacn.com, prio 2
[18:52:44:317]P2P API Version: 244.3.3.1
[18:52:44:317]tuya p2p rtc sdk version: 0xf4030301, Jun 25 2021 11:37:08
[18:52:44:328]use system dns ip 717233933 for domain m2.tuyacn.com
[18:52:44:338]unw_add_dns_cache [m2.tuyacn.com]<->[717233933]
[18:52:44:494]|105242.841 TUYA 792 | [IPC_APP_Get_Net_Status_cb]: Dbg:Net status change to:11
[18:52:44:506]|105242.841 TUYA 829 | [IPC_APP_Get_Net_Status_cb]: Dbg:mqtt is online...... Mqtt上线 (250ms就可以联网到上线)
[18:52:45:424]|105243.786 TP2P 112 | [SPARK] chn[0] type[1]video start 出图完成
使用tuya Static DNS的日志,见test_1.log
[15:37:58:586]|073756.589 MAIN 114 | App Start 系统启动
[15:37:59:637]|073757.497 TUYA 275 | Set g_mo_wifi_status ======================== 1 连网完成
[15:37:59:673]unw_gethostbyname m2.tuyacn.com, prio 0
[15:37:59:683]match_region 1
[15:37:59:683]use tuya dns service to get ip for domain m2.tuyacn.com
[15:37:59:694]unw_gethostbyname h2.iot-dns.com, prio 0
[15:37:59:694]match_region 1
[15:37:59:694]use static dns ip -1576137070 for domain h2.iot-dns.com
[15:37:59:761]P2P API Version: 244.3.3.1
[15:37:59:773]tuya p2p rtc sdk version: 0xf4030301, Jun 25 2021 11:37:08
[15:37:59:867][01-01 08:00:00:514 TUYA Err][tuya_ipc_p2p.c:4762] p2p v3 init ok
[15:37:59:867]mqtt p2p LISTEN session........
[15:37:59:888]1532 INFO src/tuya_rtc.c:5539: try listen
[15:38:00:015]tuya dns service get ip 717233829 for m2.tuyacn.com
[15:38:00:029]unw_add_dns_cache [m2.tuyacn.com]<->[717233829]
[15:38:00:042]unw_gethostbyname a2.tuyacn.com, prio 0
[15:38:00:055]match_region 1
[15:38:00:055]use tuya dns service to get ip for domain a2.tuyacn.com
[15:38:00:055]unw_gethostbyname h2.iot-dns.com, prio 0
[15:38:00:055]match_region 1
[15:38:00:069]use static dns ip -1576137070 for domain h2.iot-dns.com
[15:38:00:463]|073758.424 TUYA 797 | [IPC_APP_Get_Net_Status_cb]: Dbg:Net status change to:11
[15:38:00:463]|073758.424 TUYA 834 | [IPC_APP_Get_Net_Status_cb]: Dbg:mqtt is online...... Mqtt上线(连网到上线大概800+ms)
[15:38:01:319]|073759.259 TP2P 112 | [SPARK] chn[0] type[1]video start 出图完成