Unverified Commit 151d3c56 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

Curl_getoff_all_pipelines: improved for multiplexed

On multiplexed connections, transfers can be removed from anywhere not
just at the head as for pipelines.
parent c8373e3d
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -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,6 +900,9 @@ static struct Curl_easy* gethandleathead(struct curl_llist *pipeline)
void Curl_getoff_all_pipelines(struct Curl_easy *data,
                               struct connectdata *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 &&
@@ -909,6 +913,12 @@ void Curl_getoff_all_pipelines(struct Curl_easy *data,
    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)
{