You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2015/09/11 23:18:32 UTC

trafficserver git commit: TS-3906: Updates to the active and idle queues

Repository: trafficserver
Updated Branches:
  refs/heads/master e1ce42805 -> d620b2a5f


TS-3906: Updates to the active and idle queues


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d620b2a5
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d620b2a5
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d620b2a5

Branch: refs/heads/master
Commit: d620b2a5fb25939e87e77143f0712595daabba46
Parents: e1ce428
Author: Bryan Call <bc...@apache.org>
Authored: Fri Sep 11 14:18:14 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Fri Sep 11 14:18:14 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/d620b2a5/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/d620b2a5/proxy/http/HttpClientSession.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc
index 0ba1e54..4e89546 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/d620b2a5/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