Skip to content

Commit 237f7d9

Browse files
igrrdevyte
authored andcommitted
ESP8266HTTPClient: allow changing connection timeout using setTimeout (#4038)
Call Client::setTimeout before connection to influence connection timeout. Closes #3451.
1 parent 7fc23c6 commit 237f7d9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ bool HTTPClient::connect(void)
840840
}
841841

842842
_tcp = _transportTraits->create();
843+
_tcp->setTimeout(_tcpTimeout);
843844

844845
if(!_tcp->connect(_host.c_str(), _port)) {
845846
DEBUG_HTTPCLIENT("[HTTP-Client] failed connect to %s:%u\n", _host.c_str(), _port);
@@ -854,8 +855,6 @@ bool HTTPClient::connect(void)
854855
return false;
855856
}
856857

857-
// set Timeout for readBytesUntil and readStringUntil
858-
_tcp->setTimeout(_tcpTimeout);
859858

860859
#ifdef ESP8266
861860
_tcp->setNoDelay(true);

0 commit comments

Comments
 (0)