summaryrefslogtreecommitdiff
path: root/lib/easy.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-11-24 23:20:19 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-24 23:20:19 +0100
commitd04cef9ce1d710902d90b62de01115b9bbe958bf (patch)
tree016430aca52221cb38fd34fc2c0722a4eef062ab /lib/easy.c
parentae7a09db20081672242cbf69bb871f3ab1c5a24c (diff)
downloadcurl-bagder/easy_transfer-timeout.tar.gz
curl_easy_perform: fix timeout handlingbagder/easy_transfer-timeout
curl_multi_wait() was erroneously used from within curl_easy_perform(). It could lead to it believing there was no socket to wait for and then instead sleep for a while instead of monitoring the socket and then miss acting on that activity as swiftly as it should (causing an up to 1000 ms delay). Reported-by: Antoni Villalonga Fixes #3305 Clodes #3306
Diffstat (limited to 'lib/easy.c')
-rw-r--r--lib/easy.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/easy.c b/lib/easy.c
index d940b5d3e..e592d7a71 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -664,12 +664,12 @@ static CURLcode easy_transfer(struct Curl_multi *multi)
while(!done && !mcode) {
int still_running = 0;
- int rc;
+ bool gotsocket = FALSE;
- mcode = curl_multi_wait(multi, NULL, 0, 1000, &rc);
+ mcode = Curl_multi_wait(multi, NULL, 0, 1000, NULL, &gotsocket);
if(!mcode) {
- if(!rc) {
+ if(!gotsocket) {
long sleep_ms;
/* If it returns without any filedescriptor instantly, we need to
@@ -688,6 +688,7 @@ static CURLcode easy_transfer(struct Curl_multi *multi)
/* only read 'still_running' if curl_multi_perform() return OK */
if(!mcode && !still_running) {
+ int rc;
CURLMsg *msg = curl_multi_info_read(multi, &rc);
if(msg) {
result = msg->data.result;