cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH] multi: return CURLM_CALL_MULTI_PERFORM in PERFORM phase

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Mon, 7 Oct 2013 17:13:50 +0200

... if there is nothing to wait for. This fixes a regression introduced
by commit 0feeab78 limiting the speed of SCP upload to 16384 B/s on a
fast connection (such as localhost).

---
 RELEASE-NOTES  |    1 +
 lib/multi.c    |    5 ++++-
 lib/transfer.c |    4 +++-
 lib/transfer.h |    3 ++-
 4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index ab59159..8dc2eb3 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -59,6 +59,7 @@ This release includes the following bugfixes:
  o win32: fix Visual Studio 2010 build with WINVER >= 0x600 [22]
  o configure: use icc options without space [21]
  o test1112: Increase the timeout from 7s to 16s [20]
+ o SCP: upload speed on a fast connection limited to 16384 B/s
 
 This release includes the following known bugs:
 
diff --git a/lib/multi.c b/lib/multi.c
index e723a3e..9b5579d 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1412,6 +1412,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
       {
       char *newurl = NULL;
       bool retry = FALSE;
+      bool any_progress = FALSE;
 
       /* check if over send speed */
       if((data->set.max_send_speed > 0) &&
@@ -1446,7 +1447,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
       }
 
       /* read/write data if it is ready to do so */
-      data->result = Curl_readwrite(data->easy_conn, &done);
+      data->result = Curl_readwrite(data->easy_conn, &done, &any_progress);
 
       k = &data->req;
 
@@ -1553,6 +1554,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
           result = CURLM_CALL_MULTI_PERFORM;
         }
       }
+      else if(any_progress)
+        result = CURLM_CALL_MULTI_PERFORM;
 
       if(newurl)
         free(newurl);
diff --git a/lib/transfer.c b/lib/transfer.c
index 533e394..bffd6d3 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -985,7 +985,8 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
  * be read and written to/from the connection.
  */
 CURLcode Curl_readwrite(struct connectdata *conn,
-                        bool *done)
+                        bool *done,
+                        bool *any_progress)
 {
   struct SessionHandle *data = conn->data;
   struct SingleRequest *k = &data->req;
@@ -1042,6 +1043,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
 
   k->now = Curl_tvnow();
   if(didwhat) {
+    *any_progress = true;
     /* Update read/write counters */
     if(k->bytecountp)
       *k->bytecountp = k->bytecount; /* read count */
diff --git a/lib/transfer.h b/lib/transfer.h
index ad4a3ac..f32a957 100644
--- a/lib/transfer.h
+++ b/lib/transfer.h
@@ -40,7 +40,8 @@ CURLcode Curl_follow(struct SessionHandle *data, char *newurl,
                      followtype type);
 
 
-CURLcode Curl_readwrite(struct connectdata *conn, bool *done);
+CURLcode Curl_readwrite(struct connectdata *conn, bool *done,
+                        bool *any_progress);
 int Curl_single_getsock(const struct connectdata *conn,
                         curl_socket_t *socks,
                         int numsocks);
-- 
1.7.1
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-10-07