aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-05-15 20:43:32 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-05-15 21:28:19 +0200
commit84bd19ffd4374fd7b4fbe5a0ee0ecbf263d52ede (patch)
tree3262cadb8d5a84edfa0ce7b7e758309f4d56861c /lib/connect.c
parent678239df547bacf762dea664dabf1ce207f0a048 (diff)
timers: fix timer regression involving redirects / reconnects
In commit 0b3750b5c23c25f (released in 7.36.0) we fixed a timeout issue but instead broke the timings. To fix this, I introduce a new timestamp to use for the timeouts and restored the previous timestamp and timestamp position so that the old timer functionality is restored. In addition to that, that change also broke connection timeouts for when more than one connect was used (as it would then count the total time from the first connect and not for the most recent one). Now Curl_timeleft() has been modified so that it checks against different start times depending on which timeout it checks. Test 1303 is updated accordingly. Bug: http://curl.haxx.se/mail/lib-2014-05/0147.html Reported-by: Ryan Braud
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/connect.c b/lib/connect.c
index b35c36c00..ca6e3466c 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -224,7 +224,12 @@ long Curl_timeleft(struct SessionHandle *data,
}
/* subtract elapsed time */
- timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle);
+ if(duringconnect)
+ /* since this most recent connect started */
+ timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle);
+ else
+ /* since the entire operation started */
+ timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startop);
if(!timeout_ms)
/* avoid returning 0 as that means no timeout! */
return -1;