Commit 22569681 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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

for FTP command responses take >1 second.
parent e615d117
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -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() */

+8 −6
Original line number Diff line number Diff line
@@ -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;
  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;
  if(size > 0)
    data->progress.flags |= PGRS_UL_SIZE_KNOWN;
  }
  else
    data->progress.flags &= ~PGRS_UL_SIZE_KNOWN;
}

/* EXAMPLE OUTPUT to follow: