Skip to content

Commit

Permalink
move call to setTimeout() to after the client connects. (#2214)
Browse files Browse the repository at this point in the history
This is necessary to avoid this log entry from being generated due to invalid usage of setTimeout:
[E][WiFiClient.cpp:236] setSocketOption(): 1006 : 9
  • Loading branch information
atanisoft authored and me-no-dev committed Dec 18, 2018
1 parent 512d0d0 commit 0de0d3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/HTTPClient/src/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,14 +966,14 @@ bool HTTPClient::connect(void)
return false;
}

// set Timeout for WiFiClient and for Stream::readBytesUntil() and Stream::readStringUntil()
_client->setTimeout((_tcpTimeout + 500) / 1000);

if(!_client->connect(_host.c_str(), _port)) {
log_d("failed connect to %s:%u", _host.c_str(), _port);
return false;
}

// set Timeout for WiFiClient and for Stream::readBytesUntil() and Stream::readStringUntil()
_client->setTimeout((_tcpTimeout + 500) / 1000);

log_d(" connected to %s:%u", _host.c_str(), _port);

#ifdef HTTPCLIENT_1_1_COMPATIBLE
Expand Down

0 comments on commit 0de0d3f

Please sign in to comment.