From e3a5ae439bb94ae13bd970d9484d4665e1df4972 Mon Sep 17 00:00:00 2001 From: h3ndrik Date: Sun, 4 Mar 2018 20:53:04 +0100 Subject: [PATCH] clean up faster (fixes #828) (#1087) flush tcp buffer instead of reading it byte by byte. --- libraries/HTTPClient/src/HTTPClient.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/HTTPClient/src/HTTPClient.cpp b/libraries/HTTPClient/src/HTTPClient.cpp index 1c604d56..d39e89ce 100644 --- a/libraries/HTTPClient/src/HTTPClient.cpp +++ b/libraries/HTTPClient/src/HTTPClient.cpp @@ -232,9 +232,7 @@ void HTTPClient::end(void) if(connected()) { if(_tcp->available() > 0) { log_d("still data in buffer (%d), clean up.", _tcp->available()); - while(_tcp->available() > 0) { - _tcp->read(); - } + _tcp->flush(); } if(_reuse && _canReuse) { log_d("tcp keep open for reuse");