You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/12/07 20:32:01 UTC

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

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

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


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

commit ee44a25e88e67d9d692b1f4e39400d53bf9d8971
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)
    
    (cherry picked from commit bb40940f394609ba359c9f2a132fae4af0e0e4cd)
---
 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 0dc0fb2..d7607fa 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) {