From: Daniel Stenberg Date: Sun, 14 Jul 2013 15:33:24 +0000 (+0200) Subject: curl_easy_perform: gradually increase the delay time X-Git-Tag: upstream/7.37.1~1536 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d529f3882b9bca2c3eb32295dd6b2609d0c9b51f;p=platform%2Fupstream%2Fcurl.git curl_easy_perform: gradually increase the delay time Instead of going 50,100,150 etc millisecond delay time when nothing has been found to do or wait for, we now start lower and double each loop as in 4,8,16,32 etc. This lowers the minimum wait without sacrifizing the longer wait too much with unnecessary CPU cycles burnt. Bug: http://curl.haxx.se/mail/lib-2013-07/0103.html Reported-by: Andreas Malzahn --- diff --git a/lib/easy.c b/lib/easy.c index 995328e..d84ecf5 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -539,9 +539,7 @@ CURLcode curl_easy_perform(CURL *easy) if(curlx_tvdiff(after, before) <= 10) { without_fds++; if(without_fds > 2) { - int sleep_ms = without_fds * 50; - if(sleep_ms > 1000) - sleep_ms = 1000; + int sleep_ms = without_fds < 10 ? (1 << (without_fds-1)): 1000; Curl_wait_ms(sleep_ms); } }