Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit df523c0

Browse files
committed
reuse HTTPClient::end
1 parent 3a68e6c commit df523c0

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/FirebaseHttpClient_Esp8266.cpp

+4-16
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,10 @@
2222
class ForceReuseHTTPClient : public HTTPClient {
2323
public:
2424
void end() {
25-
if(connected()) {
26-
if(_tcp->available() > 0) {
27-
DEBUG_HTTPCLIENT("[HTTP-Client][end] still data in buffer (%d), clean up.\n", _tcp->available());
28-
while(_tcp->available() > 0) {
29-
_tcp->read();
30-
}
31-
}
32-
if(_reuse && (_canReuse || _forceReuse)) {
33-
DEBUG_HTTPCLIENT("[HTTP-Client][end] tcp keep open for reuse\n");
34-
} else {
35-
DEBUG_HTTPCLIENT("[HTTP-Client][end] tcp stop\n");
36-
_tcp->stop();
37-
}
38-
} else {
39-
DEBUG_HTTPCLIENT("[HTTP-Client][end] tcp is closed\n");
40-
}
25+
if (_forceReuse) {
26+
_canReuse = true;
27+
}
28+
HTTPClient::end();
4129
}
4230
void forceReuse(bool forceReuse) {
4331
_forceReuse = forceReuse;

0 commit comments

Comments
 (0)