diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-05-14 06:31:00 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-05-14 06:31:00 +0000 |
commit | 22569681bc2e8cb5173b042561b44cceda88589b (patch) | |
tree | a7ce0a51124d0d2b0ba8e92a0b7a289812cd8253 /lib | |
parent | e615d117a010e068f3d0639928cc9555b14c0077 (diff) |
George Comninos provided a fix that calls the progress meter when waiting
for FTP command responses take >1 second.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftp.c | 14 | ||||
-rw-r--r-- | lib/progress.c | 14 |
2 files changed, 18 insertions, 10 deletions
@@ -238,7 +238,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ if(!ftp->cache) { readfd = rkeepfd; /* set every lap */ - interval.tv_sec = timeout; + interval.tv_sec = 1; /* use 1 second timeout intervals */ interval.tv_usec = 0; switch (select (sockfd+1, &readfd, NULL, NULL, &interval)) { @@ -247,9 +247,10 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ failf(data, "Transfer aborted due to select() error: %d", errno); break; case 0: /* timeout */ - result = CURLE_OPERATION_TIMEDOUT; - failf(data, "Transfer aborted due to timeout"); - break; + if(Curl_pgrsUpdate(conn)) + return CURLE_ABORTED_BY_CALLBACK; + continue; /* just continue in our loop for the timeout duration */ + default: break; } @@ -2117,6 +2118,11 @@ CURLcode Curl_ftp(struct connectdata *conn) ftp = conn->proto.ftp; conn->size = -1; /* make sure this is unknown at this point */ + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + Curl_pgrsSetUploadSize(data, 0); + Curl_pgrsSetDownloadSize(data, 0); + /* fixed : initialize ftp->dirs[xxx] to NULL ! is done in Curl_ftp_connect() */ diff --git a/lib/progress.c b/lib/progress.c index 414ee2c1f..5036efaeb 100644 --- a/lib/progress.c +++ b/lib/progress.c @@ -172,18 +172,20 @@ void Curl_pgrsSetUploadCounter(struct SessionHandle *data, double size) void Curl_pgrsSetDownloadSize(struct SessionHandle *data, double size) { - if(size > 0) { - data->progress.size_dl = size; + data->progress.size_dl = size; + if(size > 0) data->progress.flags |= PGRS_DL_SIZE_KNOWN; - } + else + data->progress.flags &= ~PGRS_DL_SIZE_KNOWN; } void Curl_pgrsSetUploadSize(struct SessionHandle *data, double size) { - if(size > 0) { - data->progress.size_ul = size; + data->progress.size_ul = size; + if(size > 0) data->progress.flags |= PGRS_UL_SIZE_KNOWN; - } + else + data->progress.flags &= ~PGRS_UL_SIZE_KNOWN; } /* EXAMPLE OUTPUT to follow: |