1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

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.
This commit is contained in:
Adriano Meirelles 2011-09-08 08:38:59 +02:00 committed by Daniel Stenberg
parent 28d09cb0f5
commit 81ead2c4e7

View File

@ -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 */