]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Update docs and make pop() check the context being removed
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 17 Nov 2015 06:50:47 +0000 (22:50 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 17 Nov 2015 06:50:47 +0000 (22:50 -0800)
src/Pipeline.cc
src/Pipeline.h
src/client_side.cc

index 15190d618c835c4753978ae766764093900cdc43..c1c044d5dc569c5984244926cb3da54214f3ba50 100644 (file)
@@ -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();
 }
 
index ae040e1dd54cb5f4ac4591aee9e67479a991fc16..de0e463345edfe48fec619b48b6ea55b95d31296 100644 (file)
@@ -17,16 +17,19 @@ class ClientSocketContext;
 typedef RefCount<ClientSocketContext> 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.
index 904d2f0714f23c62f4a92560679a79ba6a398b0b..c497fa471a3503e79c5d9d53e8da0433e18cc26e 100644 (file)
@@ -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);