Skip to content

Commit 0de0d3f

Browse files
atanisoftme-no-dev
authored andcommitted
move call to setTimeout() to after the client connects. (espressif#2214)
This is necessary to avoid this log entry from being generated due to invalid usage of setTimeout: [E][WiFiClient.cpp:236] setSocketOption(): 1006 : 9
1 parent 512d0d0 commit 0de0d3f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: libraries/HTTPClient/src/HTTPClient.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -966,14 +966,14 @@ bool HTTPClient::connect(void)
966966
return false;
967967
}
968968

969-
// set Timeout for WiFiClient and for Stream::readBytesUntil() and Stream::readStringUntil()
970-
_client->setTimeout((_tcpTimeout + 500) / 1000);
971-
972969
if(!_client->connect(_host.c_str(), _port)) {
973970
log_d("failed connect to %s:%u", _host.c_str(), _port);
974971
return false;
975972
}
976973

974+
// set Timeout for WiFiClient and for Stream::readBytesUntil() and Stream::readStringUntil()
975+
_client->setTimeout((_tcpTimeout + 500) / 1000);
976+
977977
log_d(" connected to %s:%u", _host.c_str(), _port);
978978

979979
#ifdef HTTPCLIENT_1_1_COMPATIBLE

0 commit comments

Comments
 (0)