trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shinr...@apache.org
Subject [trafficserver] branch master updated: TS-4543: Fix core in HttpSM::tunnel_handler_post. This closes #718.
Date Wed, 15 Jun 2016 21:49:23 GMT
This is an automated email from the ASF dual-hosted git repository.

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

The following commit(s) were added to refs/heads/master by this push:
       new  e5db6be   TS-4543: Fix core in HttpSM::tunnel_handler_post. This closes #718.
e5db6be is described below

commit e5db6be875d4f4d5d291ac249ae2a9f7fed562a6
Author: shinrich <shinrich@localhost.localdomain>
AuthorDate: Wed Jun 15 08:24:26 2016 -0500

    TS-4543: Fix core in HttpSM::tunnel_handler_post. This closes #718.
---
 proxy/http/HttpSM.cc    |  9 ++++++---
 proxy/http/HttpTunnel.h | 12 ++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 202e4b8..fdc18fe 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2722,7 +2722,10 @@ HttpSM::tunnel_handler_post(int event, void *data)
 {
   STATE_ENTER(&HttpSM::tunnel_handler_post, event);
 
-  HttpTunnelProducer *p = tunnel.get_producer(ua_session);
+  HttpTunnelProducer *p = ua_session != NULL ? tunnel.get_producer(ua_session) : tunnel.get_producer(HT_HTTP_CLIENT);
+  if (!p)
+    return 0; // Cannot do anything if there is no producer
+
   if (event != HTTP_TUNNEL_EVENT_DONE) {
     if ((event == VC_EVENT_WRITE_COMPLETE) || (event == VC_EVENT_EOS)) {
       if (ua_entry->write_buffer) {
@@ -2841,9 +2844,9 @@ HttpSM::tunnel_handler_push(int event, void *data)
   ink_assert(data == &tunnel);
 
   // Check to see if the client is still around
-  HttpTunnelProducer *ua = tunnel.get_producer(ua_session);
+  HttpTunnelProducer *ua = (ua_session) ? tunnel.get_producer(ua_session) : tunnel.get_producer(HT_HTTP_CLIENT);
 
-  if (!ua->read_success) {
+  if (ua && !ua->read_success) {
     // Client failed to send the body, it's gone.  Kill the
     // state machine
     terminate_sm = true;
diff --git a/proxy/http/HttpTunnel.h b/proxy/http/HttpTunnel.h
index 7cc4a0f..54f5314 100644
--- a/proxy/http/HttpTunnel.h
+++ b/proxy/http/HttpTunnel.h
@@ -331,6 +331,7 @@ public:
   DLL<HttpTunnelConsumer> *get_consumers(VConnection *vc);
   HttpTunnelProducer *get_producer(VConnection *vc);
   HttpTunnelConsumer *get_consumer(VConnection *vc);
+  HttpTunnelProducer *get_producer(HttpTunnelType_t type);
   void tunnel_run(HttpTunnelProducer *p = NULL);
 
   int main_handler(int event, void *data);
@@ -460,6 +461,17 @@ HttpTunnel::get_producer(VConnection *vc)
   return NULL;
 }
 
+inline HttpTunnelProducer *
+HttpTunnel::get_producer(HttpTunnelType_t type)
+{
+  for (int i = 0; i < MAX_PRODUCERS; i++) {
+    if (producers[i].vc_type == type) {
+      return producers + i;
+    }
+  }
+  return NULL;
+}
+
 inline HttpTunnelConsumer *
 HttpTunnel::get_consumer(VConnection *vc)
 {

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message