]> granicus.if.org Git - curl/commitdiff
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 b7c19d0783b4f334d9bdc0ae3ad075e6e7464e4e..de5295e1d3b1b4c60a4ff03e6abfbd6d40a5da0f 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 b2a31c353c2ebdc67052cbfcd0091ae76d2bd75b..527059eac71ac68d7a08f1f89c505c3c3d419e6b 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 e0a10cfcea5709c280eb23ebd87db24bc515ba96..e531dd60ba7d30617a7b9f25692fee551f44be8a 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 32a8655b2dab9d48d01fdd79a7b44713d460b860..1671e3ae8519264657efca7455a037b1a3c67f46 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 7099f116a0043e480d33764e87c600426c65aff8..5a47e289aabb53817ca4c45b840e2354559bd11f 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 197040c1a7a68ffc20aba714ae1b50656fcd1613..8af55fb03cacfe7dbbfd1f07866680f955be2436 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 */