Skip to content

Commit

Permalink
Adapt logic to feed scheduled recurrent functions in hostByName from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
dok-net committed Oct 6, 2021
1 parent 99ed6fc commit cd8d2d3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,12 @@ int ESP8266WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResul
aResult = IPAddress(&addr);
} else if(err == ERR_INPROGRESS) {
_dns_lookup_pending = true;
esp_delay(timeout_ms, []() { return _dns_lookup_pending; });
// will resume on timeout or when wifi_dns_found_callback fires
// Will resume on timeout or when wifi_dns_found_callback fires.
// The final argument, intvl_ms, to esp_delay influences how frequently
// the scheduled recurrent functions (Schedule.h) are probed; here, to allow
// the ethernet driver perform work.
esp_delay(timeout_ms, []() { return _dns_lookup_pending; }, 1);
_dns_lookup_pending = false;
// will return here when dns_found_callback fires
if(aResult.isSet()) {
err = ERR_OK;
}
Expand Down

0 comments on commit cd8d2d3

Please sign in to comment.