You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2020/12/04 14:57:39 UTC

[trafficserver] branch master updated: Adjust flags to ensure tunnel producer is cleaned up (#7336)

This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new bb40940  Adjust flags to ensure tunnel producer is cleaned up (#7336)
bb40940 is described below

commit bb40940f394609ba359c9f2a132fae4af0e0e4cd
Author: Susan Hinrichs <sh...@yahoo-inc.com>
AuthorDate: Fri Dec 4 08:57:25 2020 -0600

    Adjust flags to ensure tunnel producer is cleaned up (#7336)
---
 proxy/http/HttpTunnel.cc | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index e87cad1..07efb08 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -1332,9 +1332,21 @@ HttpTunnel::consumer_handler(int event, HttpTunnelConsumer *c)
     if (c->producer && c->producer->handler_state == 0) {
       if (event == VC_EVENT_WRITE_COMPLETE) {
         c->producer->handler_state = HTTP_SM_POST_SUCCESS;
-        // If the consumer completed, presumably the producer successfully read and is done
+        // If the consumer completed, presumably the producer successfully read
         c->producer->read_success = true;
-        c->producer->alive        = false;
+        // Go ahead and clean up the producer side
+        if (p->alive) {
+          p->alive = false;
+          if (p->read_vio) {
+            p->bytes_read = p->read_vio->ndone;
+          } else {
+            p->bytes_read = 0;
+          }
+          if (p->vc != HTTP_TUNNEL_STATIC_PRODUCER) {
+            // Clear any outstanding reads
+            p->vc->do_io_read(nullptr, 0, nullptr);
+          }
+        }
       } else if (c->vc_type == HT_HTTP_SERVER) {
         c->producer->handler_state = HTTP_SM_POST_UA_FAIL;
       } else if (c->vc_type == HT_HTTP_CLIENT) {