From 384ee6ea7f76de675a6d53cb975f3969dd935d7f Mon Sep 17 00:00:00 2001 From: lumapu Date: Sat, 14 Sep 2024 12:10:40 +0200 Subject: [PATCH] added comments and cleanup --- src/network/AhoyNetwork.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/network/AhoyNetwork.h b/src/network/AhoyNetwork.h index e60a8e68..af3c600f 100644 --- a/src/network/AhoyNetwork.h +++ b/src/network/AhoyNetwork.h @@ -72,6 +72,8 @@ class AhoyNetwork { ip_addr_t ipaddr; mNtpIp = WiFi.gatewayIP(); + // dns_gethostbyname runs asynchronous and sets the member mNtpIp which is then checked on + // next call of updateNtpTime err_t err = dns_gethostbyname(mConfig->ntp.addr, &ipaddr, dnsCallback, this); if (err == ERR_OK) { @@ -92,6 +94,9 @@ class AhoyNetwork { this->handleNTPPacket(packet); }); sendNTPpacket(); + + // reset to start with DNS lookup next time again + mNtpIp = IPAddress(0, 0, 0, 0); } public: