From 2a02453ffb2b027e03670413ac63bfc0662ac563 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Mon, 9 May 2022 15:57:58 +0200 Subject: [PATCH 1/2] emulation on host: fix for latest changes in dnsserver --- libraries/DNSServer/src/DNSServer.cpp | 7 ++++++- libraries/DNSServer/src/DNSServer.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/DNSServer/src/DNSServer.cpp b/libraries/DNSServer/src/DNSServer.cpp index d2c41f79d7..5856ef15d6 100644 --- a/libraries/DNSServer/src/DNSServer.cpp +++ b/libraries/DNSServer/src/DNSServer.cpp @@ -2,7 +2,7 @@ #include "DNSServer.h" #include #include -#include + extern struct rst_info resetInfo; #ifdef DEBUG_ESP_PORT @@ -60,10 +60,15 @@ DNSServer::DNSServer() // They will then report connected. _ttl = lwip_htonl(60); +#if !CORE_MOCK + if (REASON_DEFAULT_RST == resetInfo.reason || REASON_DEEP_SLEEP_AWAKE <= resetInfo.reason) { _ids = random(0, BIT(16) - 1); } + +#endif // !CORE_MOCK + _ids += kDNSSQueSize; // for the case of restart, ignore any inflight responses _errorReplyCode = DNSReplyCode::NonExistentDomain; diff --git a/libraries/DNSServer/src/DNSServer.h b/libraries/DNSServer/src/DNSServer.h index 1ca16697f9..44af7e4d90 100644 --- a/libraries/DNSServer/src/DNSServer.h +++ b/libraries/DNSServer/src/DNSServer.h @@ -1,5 +1,7 @@ #ifndef DNSServer_h #define DNSServer_h + +#include #include // #define DEBUG_DNSSERVER From 34c787985681b992980b4c4066265c8c1d43e33b Mon Sep 17 00:00:00 2001 From: david gauchard Date: Tue, 10 May 2022 11:37:36 +0200 Subject: [PATCH 2/2] declare rst_info in emulation world --- libraries/DNSServer/src/DNSServer.cpp | 5 ----- tests/host/common/MockEsp.cpp | 3 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libraries/DNSServer/src/DNSServer.cpp b/libraries/DNSServer/src/DNSServer.cpp index 5856ef15d6..4ffeb88a37 100644 --- a/libraries/DNSServer/src/DNSServer.cpp +++ b/libraries/DNSServer/src/DNSServer.cpp @@ -60,15 +60,10 @@ DNSServer::DNSServer() // They will then report connected. _ttl = lwip_htonl(60); -#if !CORE_MOCK - if (REASON_DEFAULT_RST == resetInfo.reason || REASON_DEEP_SLEEP_AWAKE <= resetInfo.reason) { _ids = random(0, BIT(16) - 1); } - -#endif // !CORE_MOCK - _ids += kDNSSQueSize; // for the case of restart, ignore any inflight responses _errorReplyCode = DNSReplyCode::NonExistentDomain; diff --git a/tests/host/common/MockEsp.cpp b/tests/host/common/MockEsp.cpp index 75c609ef65..18e7be6c83 100644 --- a/tests/host/common/MockEsp.cpp +++ b/tests/host/common/MockEsp.cpp @@ -36,6 +36,9 @@ #include +#include +struct rst_info resetInfo; + unsigned long long operator"" _kHz(unsigned long long x) { return x * 1000;