summaryrefslogtreecommitdiff
path: root/lib/speedcheck.c
diff options
context:
space:
mode:
authorAdriano Meirelles <adriano@hardware.com.br>2011-09-08 08:38:59 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-09-08 08:39:53 +0200
commit81ead2c4e75a686729586ffb07d79e2efe2a60ba (patch)
tree770176bddd47647141441fdd93cef57e3ac604ba /lib/speedcheck.c
parent28d09cb0f5e553c783c596efea014a6a14b41a65 (diff)
downloadcurl-81ead2c4e75a686729586ffb07d79e2efe2a60ba.tar.gz
Curl_speedcheck: don't mistakenly clear Curl_expire()
The current version of speedcheck.c may disable timeout by setting zero to Curl_expire. Which is fine using the curl_multi_perform, because it recheck all timeout internals, but when using custom event poller (like hiperfifo.c) it may keep stalle connection forever.
Diffstat (limited to 'lib/speedcheck.c')
-rw-r--r--lib/speedcheck.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/speedcheck.c b/lib/speedcheck.c
index 13d5d233e..ca2323f57 100644
--- a/lib/speedcheck.c
+++ b/lib/speedcheck.c
@@ -41,12 +41,12 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
(Curl_tvlong(data->state.keeps_speed) != 0) &&
(data->progress.current_speed < data->set.low_speed_limit)) {
long howlong = Curl_tvdiff(now, data->state.keeps_speed);
+ long nextcheck = (data->set.low_speed_time * 1000) - howlong;
/* We are now below the "low speed limit". If we are below it
for "low speed time" seconds we consider that enough reason
to abort the download. */
-
- if((howlong/1000) > data->set.low_speed_time) {
+ if(nextcheck <= 0) {
/* we have been this slow for long enough, now die */
failf(data,
"Operation too slow. "
@@ -55,7 +55,10 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
data->set.low_speed_time);
return CURLE_OPERATION_TIMEDOUT;
}
- Curl_expire(data, howlong);
+ else {
+ /* wait complete low_speed_time */
+ Curl_expire(data, nextcheck);
+ }
}
else {
/* we keep up the required speed all right */