George Comninos provided a fix that calls the progress meter when waiting

for FTP command responses take >1 second.
This commit is contained in:
Daniel Stenberg 2003-05-14 06:31:00 +00:00
Родитель e615d117a0
Коммит 22569681bc
2 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

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

Просмотреть файл

@ -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: