Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WiFiClient watchdog usage #211

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 28 additions & 10 deletions src/WiFiClient.cpp
Expand Up @@ -63,9 +63,12 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) {

unsigned long start = millis();

// wait 4 second for the connection to close
// wait 10 second for the connection to close
while (!connected() && millis() - start < 10000)
{
delay(1);
WiFi.feedWatchdog();
}

if (!connected())
{
Expand All @@ -92,9 +95,12 @@ int WiFiClient::connectSSL(IPAddress ip, uint16_t port)

unsigned long start = millis();

// wait 4 second for the connection to close
// wait 10 second for the connection to close
while (!connected() && millis() - start < 10000)
delay(1);
{
delay(1);
WiFi.feedWatchdog();
}

if (!connected())
{
Expand All @@ -121,9 +127,12 @@ int WiFiClient::connectSSL(const char *host, uint16_t port)

unsigned long start = millis();

// wait 4 second for the connection to close
// wait 10 second for the connection to close
while (!connected() && millis() - start < 10000)
delay(1);
{
delay(1);
WiFi.feedWatchdog();
}

if (!connected())
{
Expand All @@ -150,9 +159,12 @@ int WiFiClient::connectBearSSL(IPAddress ip, uint16_t port)

unsigned long start = millis();

// wait 4 second for the connection to close
// wait 10 second for the connection to close
while (!connected() && millis() - start < 10000)
delay(1);
{
delay(1);
WiFi.feedWatchdog();
}

if (!connected())
{
Expand All @@ -179,9 +191,12 @@ int WiFiClient::connectBearSSL(const char *host, uint16_t port)

unsigned long start = millis();

// wait 4 second for the connection to close
// wait 10 second for the connection to close
while (!connected() && millis() - start < 10000)
delay(1);
{
delay(1);
WiFi.feedWatchdog();
}

if (!connected())
{
Expand Down Expand Up @@ -301,7 +316,10 @@ void WiFiClient::stop() {
int count = 0;
// wait maximum 5 secs for the connection to close
while (status() != CLOSED && ++count < 50)
delay(100);
{
delay(100);
WiFi.feedWatchdog();
}

WiFiSocketBuffer.close(_sock);
_sock = 255;
Expand Down