Skip to content

Commit

Permalink
Curl_expire_latest: ignore already expired timers
Browse files Browse the repository at this point in the history
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
Closes curl#1407
  • Loading branch information
bagder committed Apr 11, 2017
1 parent f799130 commit ab6d232
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions lib/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3001,11 +3001,14 @@ 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! */
return;
}
}

/* Just add the timeout like normal */
Expand Down
2 changes: 1 addition & 1 deletion tests/data/test1238
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TFTP RRQ
# Server-side
<reply>
<servercmd>
writedelay: 1
writedelay: 2
</servercmd>
# ~1200 bytes (so that they don't fit in two 512 byte chunks)
<data nocheck="yes">
Expand Down

0 comments on commit ab6d232

Please sign in to comment.