Repository: trafficserver
Updated Branches:
  refs/heads/6.1.x c490c891b -> dcdbcd913


TS-4131: InactivityCop doesn't close active connections that have timed out

This closes #434

(cherry picked from commit 4e2f0b818e2800964ac69656d8b4d8cbd2728e2c)


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

Branch: refs/heads/6.1.x
Commit: dcdbcd913821ed8e4c5bd602a9fc1807b357355b
Parents: c490c89
Author: Bryan Call <[email protected]>
Authored: Thu Jan 21 16:02:15 2016 -0800
Committer: Bryan Call <[email protected]>
Committed: Thu Jan 21 16:04:07 2016 -0800

----------------------------------------------------------------------
 iocore/net/P_UnixNet.h |  2 +-
 iocore/net/UnixNet.cc  | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dcdbcd91/iocore/net/P_UnixNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index a92c73c..5299c67 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -207,7 +207,7 @@ public:
   int mainNetEventExt(int event, Event *data);
   void process_enabled_list(NetHandler *);
   void manage_keep_alive_queue();
-  bool manage_active_queue();
+  bool manage_active_queue(bool ignore_queue_size);
   void add_to_keep_alive_queue(UnixNetVConnection *vc);
   void remove_from_keep_alive_queue(UnixNetVConnection *vc);
   bool add_to_active_queue(UnixNetVConnection *vc);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/dcdbcd91/iocore/net/UnixNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 7eb252a..b616f4a 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -104,7 +104,7 @@ public:
     }
 
     // Cleanup the active and keep-alive queues periodically
-    nh.manage_active_queue();
+    nh.manage_active_queue(true); // close any connections over the active 
timeout
     nh.manage_keep_alive_queue();
 
     return 0;
@@ -569,7 +569,7 @@ NetHandler::mainNetEvent(int event, Event *e)
 }
 
 bool
-NetHandler::manage_active_queue()
+NetHandler::manage_active_queue(bool ignore_queue_size = false)
 {
   const int total_connections_in = active_queue_size + keep_alive_queue_size;
   Debug("net_queue", "max_connections_per_thread_in: %d 
max_connections_active_per_thread_in: %d total_connections_in: %d "
@@ -577,7 +577,7 @@ NetHandler::manage_active_queue()
         max_connections_per_thread_in, max_connections_active_per_thread_in, 
total_connections_in, active_queue_size,
         keep_alive_queue_size);
 
-  if (max_connections_active_per_thread_in > active_queue_size) {
+  if (ignore_queue_size == false && max_connections_active_per_thread_in > 
active_queue_size) {
     return true;
   }
 
@@ -595,11 +595,15 @@ NetHandler::manage_active_queue()
     if ((vc->next_inactivity_timeout_at <= now) || 
(vc->next_activity_timeout_at <= now)) {
       _close_vc(vc, now, handle_event, closed, total_idle_time, 
total_idle_count);
     }
-    if (max_connections_active_per_thread_in > active_queue_size) {
+    if (ignore_queue_size == false && max_connections_active_per_thread_in > 
active_queue_size) {
       return true;
     }
   }
 
+  if (max_connections_active_per_thread_in > active_queue_size) {
+    return true;
+  }
+
   return false; // failed to make room in the queue, all connections are active
 }
 

Reply via email to