From 9fc805700ebf0e7798988d0b891444453a6c2b6d Mon Sep 17 00:00:00 2001 From: Thulinma Date: Fri, 30 Oct 2020 00:06:06 +0100 Subject: [PATCH] CPU usage fix for URIReader::readAll --- lib/urireader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/urireader.cpp b/lib/urireader.cpp index b52d496a..e6a49d7e 100644 --- a/lib/urireader.cpp +++ b/lib/urireader.cpp @@ -210,6 +210,9 @@ namespace HTTP{ }else if (stateType == HTTP::HTTP){ downer.continueNonBlocking(cb); + if (curPos == downer.const_data().size()){ + Util::sleep(50); + } curPos = downer.const_data().size(); }else{// streaming mode int s; @@ -220,6 +223,8 @@ namespace HTTP{ cb.dataCallback(buf.data(), s); totaal += s; + }else{ + Util::sleep(50); } } }