]> granicus.if.org Git - curl/commitdiff
file: make speedcheck use current time for checks
authorDaniel Stenberg <daniel@haxx.se>
Wed, 7 Jun 2017 11:29:46 +0000 (13:29 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 7 Jun 2017 21:01:09 +0000 (23:01 +0200)
... as it would previously just get the "now" timestamp before the
transfer starts and then not update it again.

Closes #1550

lib/file.c

index 7bd4535a0f2da4ba670f6ec5d2ae80004991e57c..c804d75e11f2e416e4a7cd50a6fcc704592897aa 100644 (file)
@@ -311,7 +311,6 @@ static CURLcode file_upload(struct connectdata *conn)
   size_t nread;
   size_t nwrite;
   curl_off_t bytecount = 0;
-  struct timeval now = Curl_tvnow();
   struct_stat file_stat;
   const char *buf2;
 
@@ -399,7 +398,7 @@ static CURLcode file_upload(struct connectdata *conn)
     if(Curl_pgrsUpdate(conn))
       result = CURLE_ABORTED_BY_CALLBACK;
     else
-      result = Curl_speedcheck(data, now);
+      result = Curl_speedcheck(data, Curl_tvnow());
   }
   if(!result && Curl_pgrsUpdate(conn))
     result = CURLE_ABORTED_BY_CALLBACK;
@@ -436,7 +435,6 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
   char *buf = data->state.buffer;
   curl_off_t bytecount = 0;
   int fd;
-  struct timeval now = Curl_tvnow();
   struct FILEPROTO *file;
 
   *done = TRUE; /* unconditionally */
@@ -585,7 +583,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
     if(Curl_pgrsUpdate(conn))
       result = CURLE_ABORTED_BY_CALLBACK;
     else
-      result = Curl_speedcheck(data, now);
+      result = Curl_speedcheck(data, Curl_tvnow());
   }
   if(Curl_pgrsUpdate(conn))
     result = CURLE_ABORTED_BY_CALLBACK;