]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi_poll: avoid busy-loop when called without easy handles attached
authorDaniel Stenberg <daniel@haxx.se>
Thu, 14 Nov 2019 14:11:23 +0000 (15:11 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 14 Nov 2019 22:22:22 +0000 (23:22 +0100)
Fixes #4594
Closes #4595
Reported-by: 3dyd on github
lib/multi.c

index 7e8e38dc9f9d129980b41e6a967b96185f679b36..a0de107f0e668ce130e3fae879d6f1e5e0d4829d 100755 (executable)
@@ -1157,6 +1157,10 @@ static CURLMcode Curl_multi_wait(struct Curl_multi *multi,
     if(!curl_multi_timeout(multi, &sleep_ms) && sleep_ms) {
       if(sleep_ms > timeout_ms)
         sleep_ms = timeout_ms;
+      /* when there are no easy handles in the multi, this holds a -1
+         timeout */
+      else if((sleep_ms < 0) && extrawait)
+        sleep_ms = timeout_ms;
       Curl_wait_ms((int)sleep_ms);
     }
   }