summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-01-27 23:45:42 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-01-27 23:48:34 +0100
commitd0032593fd0c0ca65b2e033b43004ab0ac37ab3e (patch)
tree463c250752ba4f8fa95b8b05810a9d3960d94d7c
parent179311ec37ffed5b88f446f4348993a51a168abd (diff)
downloadcurl-bagder/move-expire-timeouts.tar.gz
multi: set the EXPIRE_*TIMEOUT timers at TIMER_STARTSINGLE timebagder/move-expire-timeouts
To make sure Curl_timeleft() also thinks the timeout has been reached when one of the EXPIRE_*TIMEOUTs expires. Bug: https://curl.haxx.se/mail/lib-2019-01/0073.html Reported-by: Zhao Yisha
-rw-r--r--lib/multi.c6
-rw-r--r--lib/transfer.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 75ece15ca..130226f56 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1454,6 +1454,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
case CURLM_STATE_CONNECT:
/* Connect. We want to get a connection identifier filled in. */
Curl_pgrsTime(data, TIMER_STARTSINGLE);
+ if(data->set.timeout)
+ Curl_expire(data, data->set.timeout, EXPIRE_TIMEOUT);
+
+ if(data->set.connecttimeout)
+ Curl_expire(data, data->set.connecttimeout, EXPIRE_CONNECTTIMEOUT);
+
result = Curl_connect(data, &async, &protocol_connect);
if(CURLE_NO_CONNECTION_AVAILABLE == result) {
/* There was no connection available. We will go to the pending
diff --git a/lib/transfer.c b/lib/transfer.c
index e687e6018..3a18c7bdd 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1558,12 +1558,6 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
Curl_pgrsResetTransferSizes(data);
Curl_pgrsStartNow(data);
- if(data->set.timeout)
- Curl_expire(data, data->set.timeout, EXPIRE_TIMEOUT);
-
- if(data->set.connecttimeout)
- Curl_expire(data, data->set.connecttimeout, EXPIRE_CONNECTTIMEOUT);
-
/* In case the handle is re-used and an authentication method was picked
in the session we need to make sure we only use the one(s) we now
consider to be fine */