multi: call the progress function only once and allow abort
authorDaniel Stenberg <daniel@haxx.se>
Thu, 17 Jun 2010 13:19:30 +0000 (15:19 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 17 Jun 2010 13:19:30 +0000 (15:19 +0200)
1) no need to call the progress function twice when in the
CURLM_STATE_TOOFAST state.

2) Make sure that the progress callback's return code is
acknowledged when used

lib/multi.c

index f210dcf04473ce2899ef06404ade8372beb128a4..af1db606cf6b7d408c430d9dd86c9c252707fb77 100644 (file)
@@ -1307,7 +1307,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
 
     case CURLM_STATE_TOOFAST: /* limit-rate exceeded in either direction */
       /* if both rates are within spec, resume transfer */
-      Curl_pgrsUpdate(easy->easy_conn);
       if( ( ( easy->easy_handle->set.max_send_speed == 0 ) ||
             ( easy->easy_handle->progress.ulspeed <
               easy->easy_handle->set.max_send_speed ) )  &&
@@ -1528,8 +1527,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
 
         multistate(easy, CURLM_STATE_COMPLETED);
       }
-      else
-        Curl_pgrsUpdate(easy->easy_conn);
+      else if(Curl_pgrsUpdate(easy->easy_conn))
+        easy->result = CURLE_ABORTED_BY_CALLBACK;
     }
   } while(0);
   if((CURLM_STATE_COMPLETED == easy->state) && !easy->msg) {