Skip to content

Commit e4b2ce4

Browse files
authored
DNS resolving timeout change to prevent stack overlapping (espressif#3731)
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 7af4490 commit e4b2ce4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libraries/WiFi/src/WiFiGeneric.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -710,13 +710,13 @@ int WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResult)
710710
{
711711
ip_addr_t addr;
712712
aResult = static_cast<uint32_t>(0);
713-
waitStatusBits(WIFI_DNS_IDLE_BIT, 5000);
714-
clearStatusBits(WIFI_DNS_IDLE_BIT);
713+
waitStatusBits(WIFI_DNS_IDLE_BIT, 16000);
714+
clearStatusBits(WIFI_DNS_IDLE_BIT | WIFI_DNS_DONE_BIT);
715715
err_t err = dns_gethostbyname(aHostname, &addr, &wifi_dns_found_callback, &aResult);
716716
if(err == ERR_OK && addr.u_addr.ip4.addr) {
717717
aResult = addr.u_addr.ip4.addr;
718718
} else if(err == ERR_INPROGRESS) {
719-
waitStatusBits(WIFI_DNS_DONE_BIT, 4000);
719+
waitStatusBits(WIFI_DNS_DONE_BIT, 15000); //real internal timeout in lwip library is 14[s]
720720
clearStatusBits(WIFI_DNS_DONE_BIT);
721721
}
722722
setStatusBits(WIFI_DNS_IDLE_BIT);

0 commit comments

Comments
 (0)