Keep the keep-alive logic with the session shutdown logic in kill_this().
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d6bcb095 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d6bcb095 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d6bcb095 Branch: refs/heads/ts-1007 Commit: d6bcb095d1acacdbe1858af0a6748e0ee5d60c34 Parents: b4aea16 Author: shinrich <[email protected]> Authored: Tue Jul 14 07:26:26 2015 -0500 Committer: shinrich <[email protected]> Committed: Tue Jul 14 07:26:26 2015 -0500 ---------------------------------------------------------------------- proxy/http/HttpSM.cc | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d6bcb095/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 24ffef7..700203f 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -3181,12 +3181,9 @@ HttpSM::tunnel_handler_ua(int event, HttpTunnelConsumer *c) // TS-1007, delaying ua_session->do_io_close to kill_this // so the session_close hook occurs after the transaction close hook - } else { - ink_assert(ua_buffer_reader != NULL); - ua_session->release(ua_buffer_reader); - ua_buffer_reader = NULL; - ua_session = NULL; - } + // Also delaying the session release to kill_this in the keep_alive case + // so we don't lose any keep-alive opportunities + } return 0; } @@ -6561,9 +6558,21 @@ HttpSM::kill_this() // Delay the close of the user agent session, so the close session // occurs after the close transaction - if (ua_session != NULL) - ua_session->do_io_close(); - ua_session = NULL; + if (ua_session) { + // If this is a keep-alive client connection, just relase the client + // session rather than closing it. + if (t_state.client_info.keep_alive == HTTP_KEEPALIVE && + (t_state.www_auth_content != HttpTransact::CACHE_AUTH_SERVE || ua_session->get_bound_ss())) { + // successful keep-alive, release the client session instead of destroying it + ink_assert(ua_buffer_reader != NULL); + ua_session->release(ua_buffer_reader); + ua_buffer_reader = NULL; + } else { + // Not keep alive, go ahead and shut it down + ua_session->do_io_close(); + } + ua_session = NULL; + } // If the api shutdown & list removeal was synchronous // then the value of kill_this_async_done has changed so
