Skip to content

Commit

Permalink
Reset WiFi::_resolve to 0 after using it
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry committed Oct 12, 2016
1 parent fb96279 commit d8568ab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/WiFi.cpp
Expand Up @@ -166,9 +166,9 @@ static void wifi_cb(uint8_t u8MsgType, void *pvMsg)
{
if (WiFi._resolve != 0) {
memcpy((tstrSystemTime *)WiFi._resolve, pvMsg, sizeof(tstrSystemTime));
}

WiFi._resolve = 0;
WiFi._resolve = 0;
}
}
break;

Expand Down Expand Up @@ -244,6 +244,7 @@ int WiFiClass::init()
_submask = 0;
_gateway = 0;
_dhcp = 1;
_resolve = 0;
memset(_client, 0, sizeof(WiFiClient *) * TCP_SOCK_MAX);

// Initialize IO expander LED control (rev A then rev B)..
Expand Down Expand Up @@ -830,6 +831,7 @@ int WiFiClass::hostByName(const char* aHostname, IPAddress& aResult)
}

aResult = _resolve;
_resolve = 0;
return 1;
}
}
Expand Down Expand Up @@ -899,9 +901,12 @@ int WiFiClass::ping(IPAddress host, uint8_t ttl)
m2m_periph_gpio_set_val(M2M_PERIPH_GPIO5, 1);

if (_resolve == dstHost) {
_resolve = 0;
return WL_PING_TIMEOUT;
} else {
return (int)_resolve;
int rtt = (int)_resolve;
_resolve = 0;
return _resolve;
}
}

Expand Down

0 comments on commit d8568ab

Please sign in to comment.