1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

ESP8266HTTPClient: allow changing connection timeout using setTimeout (#4038)

Call Client::setTimeout before connection to influence connection
timeout.

Closes https://github.com/esp8266/Arduino/issues/3451.
This commit is contained in:
Ivan Grokhotkov 2017-12-28 03:53:31 +01:00 committed by Develo
parent 7fc23c6f7a
commit 237f7d9b18

View File

@ -840,6 +840,7 @@ bool HTTPClient::connect(void)
}
_tcp = _transportTraits->create();
_tcp->setTimeout(_tcpTimeout);
if(!_tcp->connect(_host.c_str(), _port)) {
DEBUG_HTTPCLIENT("[HTTP-Client] failed connect to %s:%u\n", _host.c_str(), _port);
@ -854,8 +855,6 @@ bool HTTPClient::connect(void)
return false;
}
// set Timeout for readBytesUntil and readStringUntil
_tcp->setTimeout(_tcpTimeout);
#ifdef ESP8266
_tcp->setNoDelay(true);