move call to setTimeout() to after the client connects. (#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
This commit is contained in:
atanisoft 2018-12-18 10:21:36 -08:00 committed by Me No Dev
parent 512d0d088f
commit 0de0d3f79a

View File

@ -966,14 +966,14 @@ bool HTTPClient::connect(void)
return false; 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)) { if(!_client->connect(_host.c_str(), _port)) {
log_d("failed connect to %s:%u", _host.c_str(), _port); log_d("failed connect to %s:%u", _host.c_str(), _port);
return false; 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); log_d(" connected to %s:%u", _host.c_str(), _port);
#ifdef HTTPCLIENT_1_1_COMPATIBLE #ifdef HTTPCLIENT_1_1_COMPATIBLE