Dmitry Kurochkin removed the cancelled state for pipelining, as we agreed
authorDaniel Stenberg <daniel@haxx.se>
Mon, 21 Jan 2008 23:48:58 +0000 (23:48 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 21 Jan 2008 23:48:58 +0000 (23:48 +0000)
that it is bad anyway. Starting now, removing a handle that is in used in a
pipeline will break the pipeline - it'll be set back up again but still...

CHANGES
RELEASE-NOTES
lib/multi.c
lib/sendf.c
lib/url.c
lib/urldata.h

diff --git a/CHANGES b/CHANGES
index b7c19d0..de5295e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,11 @@
 
                                   Changelog
 
+Daniel S (22 Jan 2008)
+- Dmitry Kurochkin removed the cancelled state for pipelining, as we agreed
+  that it is bad anyway. Starting now, removing a handle that is in used in a
+  pipeline will break the pipeline - it'll be set back up again but still...
+
 Yang Tse (21 Jan 2008)
 - Disable ldap support for cygwin builds, since it breaks whole build process.
   Fixing it will affect other platforms, so it is postponed for another release.
index b2a31c3..527059e 100644 (file)
@@ -58,6 +58,8 @@ This release includes the following bugfixes:
  o improved OOM handling for data url encoded HTTP POSTs when read from a file
  o test suite could pick wrong tool(s) if more than one existed in the PATH
  o curl_multi_fdset() failed to return socket while doing CONNECT over proxy
+ o curl_multi_remove_handle() on a handle that is in used for a pipeline now
+   break that pipeline
 
 This release includes the following known bugs:
 
index e0a10cf..e531dd6 100644 (file)
@@ -85,7 +85,6 @@ typedef enum {
   CURLM_STATE_TOOFAST,     /* wait because limit-rate exceeded */
   CURLM_STATE_DONE,        /* post data transfer operation */
   CURLM_STATE_COMPLETED,   /* operation complete */
-  CURLM_STATE_CANCELLED,   /* cancelled */
 
   CURLM_STATE_LAST /* not a true state, never use this */
 } CURLMstate;
@@ -216,7 +215,6 @@ static const char * const statename[]={
   "TOOFAST",
   "DONE",
   "COMPLETED",
-  "CANCELLED"
 };
 
 void curl_multi_dump(CURLM *multi_handle);
@@ -587,15 +585,12 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
       multi->num_alive--;
 
     if(easy->easy_handle->state.is_in_pipeline &&
-        easy->state > CURLM_STATE_DO &&
-        easy->state < CURLM_STATE_COMPLETED) {
-      /* If the handle is in a pipeline and has finished sending off its
-         request but not received its reponse yet, we need to remember the
-         fact that we want to remove this handle but do the actual removal at
-         a later time */
-      easy->easy_handle->state.cancelled = TRUE;
-      return CURLM_OK;
-    }
+        easy->state > CURLM_STATE_WAITDO &&
+        easy->state < CURLM_STATE_COMPLETED)
+      /* If the handle is in a pipeline and has started sending off its
+         request but not received its reponse yet, we need to close
+         connection. */
+      easy->easy_conn->bits.close = TRUE;
 
     /* The timer must be shut down before easy->multi is set to NULL,
        else the timenode will remain in the splay tree after
@@ -1351,22 +1346,16 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
           result = CURLM_CALL_MULTI_PERFORM;
       }
 
-      if(!easy->easy_handle->state.cancelled) {
-        /* post-transfer command */
-        easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE);
+      /* post-transfer command */
+      easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE);
 
-        /* after we have DONE what we're supposed to do, go COMPLETED, and
-           it doesn't matter what the Curl_done() returned! */
-        multistate(easy, CURLM_STATE_COMPLETED);
-      }
+      /* after we have DONE what we're supposed to do, go COMPLETED, and
+         it doesn't matter what the Curl_done() returned! */
+      multistate(easy, CURLM_STATE_COMPLETED);
 
       break;
 
     case CURLM_STATE_COMPLETED:
-      if(easy->easy_handle->state.cancelled)
-        /* Go into the CANCELLED state if we were cancelled */
-        multistate(easy, CURLM_STATE_CANCELLED);
-
       /* this is a completed transfer, it is likely to still be connected */
 
       /* This node should be delinked from the list now and we should post
@@ -1377,13 +1366,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
       easy->easy_conn = NULL;
       break;
 
-    case CURLM_STATE_CANCELLED:
-      /* Cancelled transfer, wait to be cleaned up */
-
-      /* Reset the conn pointer so we don't leave it dangling */
-      easy->easy_conn = NULL;
-      break;
-
     default:
       return CURLM_INTERNAL_ERROR;
     }
@@ -1481,15 +1463,6 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
   while(easy != &multi->easy) {
     CURLMcode result;
 
-    if(easy->easy_handle->state.cancelled &&
-        easy->state == CURLM_STATE_CANCELLED) {
-      /* Remove cancelled handles once it's safe to do so */
-      Curl_multi_rmeasy(multi_handle, easy->easy_handle);
-      easy->easy_handle = NULL;
-      easy = easy->next;
-      continue;
-    }
-
     result = multi_runsingle(multi, easy);
     if(result)
       returncode = result;
index 32a8655..1671e3a 100644 (file)
@@ -419,11 +419,6 @@ CURLcode Curl_client_write(struct connectdata *conn,
   struct SessionHandle *data = conn->data;
   size_t wrote;
 
-  if(data->state.cancelled) {
-    /* We just suck everything into a black hole */
-    return CURLE_OK;
-  }
-
   /* If reading is actually paused, we're forced to append this chunk of data
      to the already held data, but only if it is the same type as otherwise it
      can't work and it'll return error instead. */
index 7099f11..5a47e28 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -2477,7 +2477,7 @@ ConnectionExists(struct SessionHandle *data,
     }
 
     if(match) {
-      if(!Curl_isPipeliningEnabled(data)) {
+      if(!check->is_in_pipeline) {
         /* The check for a dead socket makes sense only in the
            non-pipelining case */
         bool dead = SocketIsDead(check->sock[FIRSTSOCKET]);
index 197040c..8af55fb 100644 (file)
@@ -1194,7 +1194,6 @@ struct UrlState {
 
   bool pipe_broke; /* TRUE if the connection we were pipelined on broke
                       and we need to restart from the beginning */
-  bool cancelled; /* TRUE if the request was cancelled */
 
 #ifndef WIN32
 /* do FTP line-end conversions on most platforms */