From: Amos Jeffries Date: Tue, 17 Nov 2015 06:50:47 +0000 (-0800) Subject: Update docs and make pop() check the context being removed X-Git-Tag: SQUID_4_0_3~5^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fad8490070a8dcee0757657f239b2157736f22f;p=thirdparty%2Fsquid.git Update docs and make pop() check the context being removed --- diff --git a/src/Pipeline.cc b/src/Pipeline.cc index 15190d618c..c1c044d5dc 100644 --- a/src/Pipeline.cc +++ b/src/Pipeline.cc @@ -47,12 +47,15 @@ Pipeline::terminateAll(int xerrno) } void -Pipeline::pop() +Pipeline::popMe(const ClientSocketContextPointer &which) { if (requests.empty()) return; debugs(33, 3, "Pipeline " << (void*)this << " drop " << requests.front()); + // in reality there may be multiple contexts doing processing in parallel. + // XXX: pipeline still assumes HTTP/1 FIFO semantics are obeyed. + assert(which == requests.front()); requests.pop_front(); } diff --git a/src/Pipeline.h b/src/Pipeline.h index ae040e1dd5..de0e463345 100644 --- a/src/Pipeline.h +++ b/src/Pipeline.h @@ -17,16 +17,19 @@ class ClientSocketContext; typedef RefCount ClientSocketContextPointer; /** - * A queue of requests awaiting completion. + * A queue of transactions awaiting completion. * - * Requests in the queue may be fully processed, but not yet delivered, + * Transactions in the queue may be fully processed, but not yet delivered, * or only partially processed. * * - HTTP/1 pipelined requests can be processed out of order but * responses MUST be written to the client in-order. + * The front() context is for the response writing transaction. + * The back context may still be reading a request payload/body. + * Other contexts are in deferred I/O state, but may be accumulating + * payload/body data to be written later. * - * - HTTP/2 multiplexed streams (aka requests) can be processed - * and delivered in any order. + * - HTTP/2 multiplexed streams can be processed and delivered in any order. * * For consistency we treat the pipeline as a FIFO queue in both cases. */ @@ -55,7 +58,7 @@ public: void terminateAll(const int xerrno); /// deregister the front request from the pipeline - void pop(); + void popMe(const ClientSocketContextPointer &); /// Number of requests seen in this pipeline (so far). /// Includes incomplete transactions. diff --git a/src/client_side.cc b/src/client_side.cc index 904d2f0714..c497fa471a 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -260,7 +260,7 @@ ClientSocketContext::finished() assert(connRegistered_); connRegistered_ = false; assert(conn->pipeline.front() == this); // XXX: still assumes HTTP/1 semantics - conn->pipeline.pop(); + conn->pipeline.popMe(ClientSocketContext::Pointer(this)); conn->kick(); // kick anything which was waiting for us to finish } @@ -2342,7 +2342,7 @@ clientTunnelOnError(ConnStateData *conn, ClientSocketContext *context, HttpReque debugs(33, 3, "Request will be tunneled to server"); if (context) { assert(conn->pipeline.front() == context); // XXX: still assumes HTTP/1 semantics - conn->pipeline.pop(); + conn->pipeline.popMe(ClientSocketContextPointer(context)); } Comm::SetSelect(conn->clientConnection->fd, COMM_SELECT_READ, NULL, NULL, 0); conn->fakeAConnectRequest("unknown-protocol", conn->preservedClientData);