Skip to content

Commit 292ad38

Browse files
authored
DNS resolving timeout change to prevent stack overlapping
Real DNS resolving timeout used by lwip library is 14[s] (7[s] for DNS1 + 7[s] for DNS2). Function WiFiGenericClass::hostByName() has timeout set to lower value (only 4[s]), so callback function may be called after this low timeout and it may overlappe stack memory used now by other function. Fixes espressif#3722
1 parent 9b75c65 commit 292ad38

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: libraries/WiFi/src/WiFiGeneric.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -664,13 +664,13 @@ int WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult)
664664
{
665665
ip_addr_t addr;
666666
aResult = static_cast<uint32_t>(0);
667-
waitStatusBits(WIFI_DNS_IDLE_BIT, 5000);
668-
clearStatusBits(WIFI_DNS_IDLE_BIT);
667+
waitStatusBits(WIFI_DNS_IDLE_BIT, 16000);
668+
clearStatusBits(WIFI_DNS_IDLE_BIT | WIFI_DNS_DONE_BIT);
669669
err_t err = dns_gethostbyname(aHostname, &addr, &wifi_dns_found_callback, &aResult);
670670
if(err == ERR_OK && addr.u_addr.ip4.addr) {
671671
aResult = addr.u_addr.ip4.addr;
672672
} else if(err == ERR_INPROGRESS) {
673-
waitStatusBits(WIFI_DNS_DONE_BIT, 4000);
673+
waitStatusBits(WIFI_DNS_DONE_BIT, 15000); //real internal timeout in lwip library is 14[s]
674674
clearStatusBits(WIFI_DNS_DONE_BIT);
675675
}
676676
setStatusBits(WIFI_DNS_IDLE_BIT);

0 commit comments

Comments
 (0)