Permalink
Browse files

add timeout to dnsLookup (thx Will)

  • Loading branch information...
1 parent e1815e9 commit c0b217c08f9bc32aec0fbfcacc761e69204987be @jcw committed Jul 5, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 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;

0 comments on commit c0b217c

Please sign in to comment.