diff options
author | Daniel Stenberg <daniel@haxx.se> | 2014-08-25 11:34:14 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-08-31 23:50:01 +0200 |
commit | cacdc27f52ba7b0bf08aa57886bfbd18bc82ebfb (patch) | |
tree | 6434aab273d0d6be76eb991bc96d6a276ca78571 /lib/speedcheck.c | |
parent | 09b5a99816a24a12f769f61db5f7eafd4bc32795 (diff) | |
download | curl-cacdc27f52ba7b0bf08aa57886bfbd18bc82ebfb.tar.gz |
low-speed-limit: avoid timeout flood
Introducing Curl_expire_latest(). To be used when we the code flow only
wants to get called at a later time that is "no later than X" so that
something can be checked (and another timeout be added).
The low-speed logic for example could easily be made to set very many
expire timeouts if it would be called faster or sooner than what it had
set its own timer and this goes for a few other timers too that aren't
explictiy checked for timer expiration in the code.
If there's no condition the code that says if(time-passed >= TIME), then
Curl_expire_latest() is preferred to Curl_expire().
If there exists such a condition, it is on the other hand important that
Curl_expire() is used and not the other.
Bug: http://curl.haxx.se/mail/lib-2014-06/0235.html
Reported-by: Florian Weimer
Diffstat (limited to 'lib/speedcheck.c')
-rw-r--r-- | lib/speedcheck.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/speedcheck.c b/lib/speedcheck.c index ea17a5975..ac7447c41 100644 --- a/lib/speedcheck.c +++ b/lib/speedcheck.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -57,7 +57,7 @@ CURLcode Curl_speedcheck(struct SessionHandle *data, } else { /* wait complete low_speed_time */ - Curl_expire(data, nextcheck); + Curl_expire_latest(data, nextcheck); } } else { @@ -68,7 +68,7 @@ CURLcode Curl_speedcheck(struct SessionHandle *data, /* if there is a low speed limit enabled, we set the expire timer to make this connection's speed get checked again no later than when this time is up */ - Curl_expire(data, data->set.low_speed_time*1000); + Curl_expire_latest(data, data->set.low_speed_time*1000); } return CURLE_OK; } |