Repository: trafficserver Updated Branches: refs/heads/6.0.x e31e4e66c -> 59b1e44c9
TS-3906: Updates to the active and idle queues (cherry picked from commit d620b2a5fb25939e87e77143f0712595daabba46) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3e723dfd Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3e723dfd Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3e723dfd Branch: refs/heads/6.0.x Commit: 3e723dfd0ccb542d35c2672442f319e42cc33350 Parents: e31e4e6 Author: Bryan Call <[email protected]> Authored: Fri Sep 11 14:18:14 2015 -0700 Committer: Bryan Call <[email protected]> Committed: Fri Sep 11 14:21:50 2015 -0700 ---------------------------------------------------------------------- iocore/net/UnixNet.cc | 7 +++++-- proxy/http/HttpClientSession.cc | 2 +- proxy/http2/Http2ConnectionState.cc | 8 ++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3e723dfd/iocore/net/UnixNet.cc ---------------------------------------------------------------------- diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc index 3c454a9..131a12f 100644 --- a/iocore/net/UnixNet.cc +++ b/iocore/net/UnixNet.cc @@ -619,7 +619,7 @@ NetHandler::manage_keep_alive_queue() Debug("net_queue", "max_connections_per_thread_in: %d total_connections_in: %d active_queue_size: %d keep_alive_queue_size: %d", max_connections_per_thread_in, total_connections_in, active_queue_size, keep_alive_queue_size); - if (total_connections_in <= max_connections_per_thread_in) { + if (!max_connections_per_thread_in || total_connections_in <= max_connections_per_thread_in) { return; } @@ -672,7 +672,10 @@ NetHandler::_close_vc(UnixNetVConnection *vc, ink_hrtime now, int &handle_event, ++closed; } else { vc->next_inactivity_timeout_at = now; - keep_alive_queue.head->handleEvent(EVENT_IMMEDIATE, NULL); + // create a dummy event + Event event; + event.ethread = this_ethread(); + keep_alive_queue.head->handleEvent(EVENT_IMMEDIATE, &event); ++handle_event; } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3e723dfd/proxy/http/HttpClientSession.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc index f02834c..eaa8613 100644 --- a/proxy/http/HttpClientSession.cc +++ b/proxy/http/HttpClientSession.cc @@ -529,9 +529,9 @@ HttpClientSession::release(IOBufferReader *r) SET_HANDLER(&HttpClientSession::state_keep_alive); ka_vio = this->do_io_read(this, INT64_MAX, read_buffer); ink_assert(slave_ka_vio != ka_vio); - client_vc->add_to_keep_alive_queue(); client_vc->set_inactivity_timeout(HRTIME_SECONDS(ka_in)); client_vc->cancel_active_timeout(); + client_vc->add_to_keep_alive_queue(); } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3e723dfd/proxy/http2/Http2ConnectionState.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index e14f005..86f215e 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -820,6 +820,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id) ink_assert(client_streams_count < UINT32_MAX); ++client_streams_count; + ua_session->get_netvc()->add_to_active_queue(); return new_stream; } @@ -860,6 +861,9 @@ Http2ConnectionState::cleanup_streams() s = next; } client_streams_count = 0; + if (!is_state_closed()) { + ua_session->get_netvc()->add_to_keep_alive_queue(); + } } void @@ -870,6 +874,10 @@ Http2ConnectionState::delete_stream(Http2Stream *stream) ink_assert(client_streams_count > 0); --client_streams_count; + + if (client_streams_count == 0) { + ua_session->get_netvc()->add_to_keep_alive_queue(); + } } void
