summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-07-04 01:20:31 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-07-05 22:25:22 +0200
commit858991c9c5b7e7db6529ebc1401ef2532b0ad19e (patch)
tree96bb441a240ed8db4d47e1b4ada82381a89f0bdc
parent771b256f3607b93712af27fee534c4ac308a364c (diff)
downloadcurl-858991c9c5b7e7db6529ebc1401ef2532b0ad19e.tar.gz
Curl_getoff_all_pipelines: improved for multiplexed
-rw-r--r--lib/url.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/url.c b/lib/url.c
index a73160327..81755440b 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -847,6 +847,7 @@ static int IsPipeliningPossible(const struct Curl_easy *handle,
return avail;
}
+/* Returns non-zero if a handle was removed */
int Curl_removeHandleFromPipeline(struct Curl_easy *handle,
struct curl_llist *pipeline)
{
@@ -895,15 +896,25 @@ static struct Curl_easy* gethandleathead(struct curl_llist *pipeline)
void Curl_getoff_all_pipelines(struct Curl_easy *data,
struct connectdata *conn)
{
- bool recv_head = (conn->readchannel_inuse &&
- Curl_recvpipe_head(data, conn));
- bool send_head = (conn->writechannel_inuse &&
- Curl_sendpipe_head(data, conn));
-
- if(Curl_removeHandleFromPipeline(data, &conn->recv_pipe) && recv_head)
- Curl_pipeline_leave_read(conn);
- if(Curl_removeHandleFromPipeline(data, &conn->send_pipe) && send_head)
- Curl_pipeline_leave_write(conn);
+ if(!conn->bundle)
+ return;
+ if(conn->bundle->multiuse == BUNDLE_PIPELINING) {
+ bool recv_head = (conn->readchannel_inuse &&
+ Curl_recvpipe_head(data, conn));
+ bool send_head = (conn->writechannel_inuse &&
+ Curl_sendpipe_head(data, conn));
+
+ if(Curl_removeHandleFromPipeline(data, &conn->recv_pipe) && recv_head)
+ Curl_pipeline_leave_read(conn);
+ if(Curl_removeHandleFromPipeline(data, &conn->send_pipe) && send_head)
+ Curl_pipeline_leave_write(conn);
+ }
+ else {
+ int rc;
+ rc = Curl_removeHandleFromPipeline(data, &conn->recv_pipe);
+ rc += Curl_removeHandleFromPipeline(data, &conn->send_pipe);
+ fprintf(stderr, "%s:%d %s == %d\n", __FILE__, __LINE__, __func__, rc);
+ }
}
static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke)