diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-07-04 01:20:31 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-07-11 23:41:24 +0200 |
commit | 151d3c56dcadc6b04508bdcb85acf2f0f96e4aff (patch) | |
tree | ea361a8daa7c95964f827353feed116d4f4e0d02 /lib | |
parent | c8373e3dfc324e51f2221fefc4edff69d00f933c (diff) |
Curl_getoff_all_pipelines: improved for multiplexed
On multiplexed connections, transfers can be removed from anywhere not
just at the head as for pipelines.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/url.c | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -851,6 +851,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) { @@ -899,15 +900,24 @@ 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); + } } static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke) |