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) && (Curl_tvlong(data->state.keeps_speed) != 0) &&
(data->progress.current_speed < data->set.low_speed_limit)) { (data->progress.current_speed < data->set.low_speed_limit)) {
long howlong = Curl_tvdiff(now, data->state.keeps_speed); 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 /* We are now below the "low speed limit". If we are below it
for "low speed time" seconds we consider that enough reason for "low speed time" seconds we consider that enough reason
to abort the download. */ to abort the download. */
if(nextcheck <= 0) {
if((howlong/1000) > data->set.low_speed_time) {
/* we have been this slow for long enough, now die */ /* we have been this slow for long enough, now die */
failf(data, failf(data,
"Operation too slow. " "Operation too slow. "
@ -55,7 +55,10 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
data->set.low_speed_time); data->set.low_speed_time);
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;
} }
Curl_expire(data, howlong); else {
/* wait complete low_speed_time */
Curl_expire(data, nextcheck);
}
} }
else { else {
/* we keep up the required speed all right */ /* we keep up the required speed all right */