Skip to content

Commit aa04757

Browse files
committed
Fix WiFiClient watchdog usage
1 parent 0641791 commit aa04757

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

src/WiFiClient.cpp

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,12 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) {
6363

6464
unsigned long start = millis();
6565

66-
// wait 4 second for the connection to close
66+
// wait 10 second for the connection to close
6767
while (!connected() && millis() - start < 10000)
68+
{
6869
delay(1);
70+
WiFi.feedWatchdog();
71+
}
6972

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

9396
unsigned long start = millis();
9497

95-
// wait 4 second for the connection to close
98+
// wait 10 second for the connection to close
9699
while (!connected() && millis() - start < 10000)
97-
delay(1);
100+
{
101+
delay(1);
102+
WiFi.feedWatchdog();
103+
}
98104

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

122128
unsigned long start = millis();
123129

124-
// wait 4 second for the connection to close
130+
// wait 10 second for the connection to close
125131
while (!connected() && millis() - start < 10000)
126-
delay(1);
132+
{
133+
delay(1);
134+
WiFi.feedWatchdog();
135+
}
127136

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

151160
unsigned long start = millis();
152161

153-
// wait 4 second for the connection to close
162+
// wait 10 second for the connection to close
154163
while (!connected() && millis() - start < 10000)
155-
delay(1);
164+
{
165+
delay(1);
166+
WiFi.feedWatchdog();
167+
}
156168

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

180192
unsigned long start = millis();
181193

182-
// wait 4 second for the connection to close
194+
// wait 10 second for the connection to close
183195
while (!connected() && millis() - start < 10000)
184-
delay(1);
196+
{
197+
delay(1);
198+
WiFi.feedWatchdog();
199+
}
185200

186201
if (!connected())
187202
{
@@ -301,7 +316,10 @@ void WiFiClient::stop() {
301316
int count = 0;
302317
// wait maximum 5 secs for the connection to close
303318
while (status() != CLOSED && ++count < 50)
304-
delay(100);
319+
{
320+
delay(100);
321+
WiFi.feedWatchdog();
322+
}
305323

306324
WiFiSocketBuffer.close(_sock);
307325
_sock = 255;

0 commit comments

Comments
 (0)