summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-04-10 23:53:33 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-04-10 23:56:44 +0200
commit034226fa4fee8bc3c797d546b3b7f36f90ae04aa (patch)
treed851ea64bd5cdbd779fed6b0581549a91c5f0626
parent5ed16e6a7ac49ce0df35e31dd89ce85a1222da65 (diff)
downloadcurl-034226fa4fee8bc3c797d546b3b7f36f90ae04aa.tar.gz
Curl_expire_latest: ignore already expired timers
If the existing timer is still in there but has expired, the new timer should be added. Reported-by: Rainer Canavan Bug: https://curl.haxx.se/mail/lib-2017-04/0030.html
-rw-r--r--lib/multi.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 46286b77b..453d39076 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -3001,11 +3001,15 @@ void Curl_expire_latest(struct Curl_easy *data, time_t milli)
if(expire->tv_sec || expire->tv_usec) {
/* This means that the struct is added as a node in the splay tree.
Compare if the new time is earlier, and only remove-old/add-new if it
- is. */
+ is. */
time_t diff = curlx_tvdiff(set, *expire);
- if(diff > 0)
- /* the new expire time was later than the top time, so just skip this */
+ if((diff > 0) && (diff < milli)) {
+ /* if the new expire time is later than the top time, skip it, but not
+ if the diff is larger than the new offset since then the previous
+ time is already expired! */
+ fprintf(stderr, "skip Curl_expire_latest = %d\n", (int)diff);
return;
+ }
}
/* Just add the timeout like normal */