aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-10-17 14:53:03 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-10-17 14:53:03 +0000
commit135cc036aa1425c52c3cf90176158c19e109cb9b (patch)
treeb79c26833f197fd3dbbd7fa68771d3194a97f36f /lib
parentf6163b375f0aeec85172e93823078de86bdd7bf1 (diff)
made the speedcheck actually work again
Diffstat (limited to 'lib')
-rw-r--r--lib/highlevel.c1
-rw-r--r--lib/speedcheck.c17
-rw-r--r--lib/speedcheck.h1
-rw-r--r--lib/urldata.h2
4 files changed, 14 insertions, 7 deletions
diff --git a/lib/highlevel.c b/lib/highlevel.c
index add9735b8..7a9dad308 100644
--- a/lib/highlevel.c
+++ b/lib/highlevel.c
@@ -174,6 +174,7 @@ _Transfer(struct connectdata *c_conn)
#define KEEP_WRITE 2
pgrsTime(data, TIMER_PRETRANSFER);
+ speedinit(data);
if (!conn->getheader) {
header = FALSE;
diff --git a/lib/speedcheck.c b/lib/speedcheck.c
index 125f077ac..d3d33e562 100644
--- a/lib/speedcheck.c
+++ b/lib/speedcheck.c
@@ -50,21 +50,24 @@
#include "sendf.h"
#include "speedcheck.h"
+void speedinit(struct UrlData *data)
+{
+ memset(&data->keeps_speed, 0, sizeof(struct timeval));
+}
+
CURLcode speedcheck(struct UrlData *data,
struct timeval now)
{
- static struct timeval keeps_speed;
-
- if((data->current_speed >= 0) &&
+ if((data->progress.current_speed >= 0) &&
data->low_speed_time &&
- (tvlong(keeps_speed) != 0) &&
- (data->current_speed < data->low_speed_limit)) {
+ (tvlong(data->keeps_speed) != 0) &&
+ (data->progress.current_speed < data->low_speed_limit)) {
/* 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( tvdiff(now, keeps_speed) > data->low_speed_time) {
+ if( tvdiff(now, data->keeps_speed) > data->low_speed_time) {
/* we have been this slow for long enough, now die */
failf(data,
"Operation too slow. "
@@ -76,7 +79,7 @@ CURLcode speedcheck(struct UrlData *data,
}
else {
/* we keep up the required speed all right */
- keeps_speed = now;
+ data->keeps_speed = now;
}
return CURLE_OK;
}
diff --git a/lib/speedcheck.h b/lib/speedcheck.h
index eb037d508..2ecef302c 100644
--- a/lib/speedcheck.h
+++ b/lib/speedcheck.h
@@ -44,6 +44,7 @@
#include "timeval.h"
+void speedinit(struct UrlData *data);
CURLcode speedcheck(struct UrlData *data,
struct timeval now);
diff --git a/lib/urldata.h b/lib/urldata.h
index e5fcf16ff..5b5da4d1f 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -503,6 +503,8 @@ struct UrlData {
#ifdef KRB4
FILE *cmdchannel;
#endif
+
+ struct timeval keeps_speed; /* this should be request-specific */
};
#define LIBCURL_NAME "libcurl"