c260e0
From 4274decb62daca78c9d43a025fc08f8d6fd3a341 Mon Sep 17 00:00:00 2001
c260e0
From: Daniel Stenberg <daniel@haxx.se>
c260e0
Date: Sun, 14 Jul 2013 17:33:24 +0200
c260e0
Subject: [PATCH] curl_easy_perform: gradually increase the delay time
c260e0
c260e0
Instead of going 50,100,150 etc millisecond delay time when nothing has
c260e0
been found to do or wait for, we now start lower and double each loop as
c260e0
in 4,8,16,32 etc.
c260e0
c260e0
This lowers the minimum wait without sacrifizing the longer wait too
c260e0
much with unnecessary CPU cycles burnt.
c260e0
c260e0
Bug: http://curl.haxx.se/mail/lib-2013-07/0103.html
c260e0
Reported-by: Andreas Malzahn
c260e0
c260e0
[upstream commit d529f3882b9bca2c3eb32295dd6b2609d0c9b51f]
c260e0
c260e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c260e0
---
c260e0
 lib/easy.c | 4 +---
c260e0
 1 file changed, 1 insertion(+), 3 deletions(-)
c260e0
c260e0
diff --git a/lib/easy.c b/lib/easy.c
c260e0
index a7051dd..13801b2 100644
c260e0
--- a/lib/easy.c
c260e0
+++ b/lib/easy.c
c260e0
@@ -465,9 +465,7 @@ CURLcode curl_easy_perform(CURL *easy)
c260e0
         if(curlx_tvdiff(after, before) <= 10) {
c260e0
           without_fds++;
c260e0
           if(without_fds > 2) {
c260e0
-            int sleep_ms = without_fds * 50;
c260e0
-            if(sleep_ms > 1000)
c260e0
-              sleep_ms = 1000;
c260e0
+            int sleep_ms = without_fds < 10 ? (1 << (without_fds-1)): 1000;
c260e0
             Curl_wait_ms(sleep_ms);
c260e0
           }
c260e0
         }
c260e0
-- 
c260e0
1.9.3
c260e0