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:
parent
7fc23c6f7a
commit
237f7d9b18
@ -840,6 +840,7 @@ bool HTTPClient::connect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_tcp = _transportTraits->create();
|
_tcp = _transportTraits->create();
|
||||||
|
_tcp->setTimeout(_tcpTimeout);
|
||||||
|
|
||||||
if(!_tcp->connect(_host.c_str(), _port)) {
|
if(!_tcp->connect(_host.c_str(), _port)) {
|
||||||
DEBUG_HTTPCLIENT("[HTTP-Client] failed connect to %s:%u\n", _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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set Timeout for readBytesUntil and readStringUntil
|
|
||||||
_tcp->setTimeout(_tcpTimeout);
|
|
||||||
|
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
_tcp->setNoDelay(true);
|
_tcp->setNoDelay(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user