You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/06/22 21:40:28 UTC
[trafficserver] 08/14: TS-4543: Fix core in
HttpSM::tunnel_handler_post. This closes #718.
This is an automated email from the ASF dual-hosted git repository.
sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
commit d4af23584556b21f8a1a8a96fb409bab3bbcb65f
Author: shinrich <sh...@localhost.localdomain>
AuthorDate: Wed Jun 15 08:24:26 2016 -0500
TS-4543: Fix core in HttpSM::tunnel_handler_post. This closes #718.
(cherry picked from commit e5db6be875d4f4d5d291ac249ae2a9f7fed562a6)
---
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 8237a56..a6cc149 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2741,7 +2741,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) {
@@ -2860,9 +2863,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 c4fce16..7ba53b1 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" <co...@trafficserver.apache.org>.