multi_poll: avoid busy-loop when called without easy handles attached

Fixes #4594
Closes #4595
Reported-by: 3dyd on github
This commit is contained in:
Daniel Stenberg 2019-11-14 15:11:23 +01:00
parent 7a46aeb0be
commit 4e1eee1500
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}
}