Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add timeout to dnsLookup (thx Will)

  • Loading branch information...
commit c0b217c08f9bc32aec0fbfcacc761e69204987be 1 parent e1815e9
Jean-Claude Wippler authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 dns.cpp
8 dns.cpp
View
@@ -80,13 +80,17 @@ static void checkForDnsAnswer (uint16_t plen) {
// use during setup, as this discards all incoming requests until it returns
bool EtherCard::dnsLookup (prog_char* name, bool fromRam) {
- while (!isLinkUp() || clientWaitingGw())
+ word start = millis();
+ while (!isLinkUp() || clientWaitingGw()) {
packetLoop(packetReceive());
+ if ((word) (millis() - start) >= 30000)
+ return false;
+ }
memset(hisip, 0, 4);
dnsRequest(name, fromRam);
- word start = millis();
+ start = millis();
while (hisip[0] == 0) {
if ((word) (millis() - start) >= 30000)
return false;
Please sign in to comment.
Something went wrong with that request. Please try again.