trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject git commit: TS-1375: Setting default inactivity timeout, if one is not set, to 1 day
Date Tue, 06 May 2014 19:54:05 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 7d2833e74 -> 6397b1610


TS-1375: Setting default inactivity timeout, if one is not set, to 1 day


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

Branch: refs/heads/master
Commit: 6397b16105cd0a48db609e924f3a567bd8f08ac0
Parents: 7d2833e
Author: Bryan Call <bcall@apache.org>
Authored: Tue May 6 12:53:58 2014 -0700
Committer: Bryan Call <bcall@apache.org>
Committed: Tue May 6 12:53:58 2014 -0700

----------------------------------------------------------------------
 CHANGES               |  2 ++
 iocore/net/UnixNet.cc | 23 +++++++++++++++++++----
 mgmt/RecordsConfig.cc |  2 ++
 3 files changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6397b161/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 751bc93..2f01c42 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-1375] Setting default inactivity timeout, if one is not set, to 1 day
+
   *) [TS-2780] Core dump in SpdyRequest::clear() in production testing of SPDY
 
   *) [TS-2744] Remove TSNetAcceptNamedProtocol assertion for unknown protocols.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6397b161/iocore/net/UnixNet.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNet.cc b/iocore/net/UnixNet.cc
index 69b620f..33806a1 100644
--- a/iocore/net/UnixNet.cc
+++ b/iocore/net/UnixNet.cc
@@ -38,9 +38,12 @@ extern "C" void fd_reify(struct ev_loop *);
 // INKqa10496
 // One Inactivity cop runs on each thread once every second and
 // loops through the list of NetVCs and calls the timeouts
-struct InactivityCop : public Continuation {
-  InactivityCop(ProxyMutex *m):Continuation(m) {
+class InactivityCop : public Continuation {
+public:
+  InactivityCop(ProxyMutex *m):Continuation(m), default_inactivity_timeout(0) {
     SET_HANDLER(&InactivityCop::check_inactivity);
+    REC_ReadConfigInteger(default_inactivity_timeout, "proxy.config.net.default_inactivity_timeout");
+    Debug("inactivity_cop", "default inactivity timeout is set to: %d", default_inactivity_timeout);
   }
   int check_inactivity(int event, Event *e) {
     (void) event;
@@ -52,7 +55,7 @@ struct InactivityCop : public Continuation {
         nh->cop_list.push(vc);
     }
     while (UnixNetVConnection *vc = nh->cop_list.pop()) {
-      // If we cannot ge tthe lock don't stop just keep cleaning
+      // If we cannot get the lock don't stop just keep cleaning
       MUTEX_TRY_LOCK(lock, vc->mutex, this_ethread());
       if (!lock.lock_acquired) {
        NET_INCREMENT_DYN_STAT(inactivity_cop_lock_acquire_failure_stat);
@@ -62,12 +65,24 @@ struct InactivityCop : public Continuation {
       if (vc->closed) {
         close_UnixNetVConnection(vc, e->ethread);
         continue;
-      } 
+      }
+
+      // set a default inactivity timeout if one is not set
+      if (vc->next_inactivity_timeout_at == 0 && default_inactivity_timeout >
0) {
+        Debug("inactivity_cop", "vc: %p inactivity timeout not set, setting a default of
%d", vc, default_inactivity_timeout);
+        vc->set_inactivity_timeout(HRTIME_SECONDS(default_inactivity_timeout));
+      } else {
+        Debug("inactivity_cop_verbose", "vc: %p timeout at: %" PRId64 " timeout in: %" PRId64,
vc, ink_hrtime_to_sec(vc->next_inactivity_timeout_at),
+            ink_hrtime_to_sec(vc->inactivity_timeout_in));
+      }
+
       if (vc->next_inactivity_timeout_at && vc->next_inactivity_timeout_at
< now)
         vc->handleEvent(EVENT_IMMEDIATE, e);
     }
     return 0;
   }
+private:
+  int default_inactivity_timeout;  // only used when one is not set for some bad reason
 };
 #endif
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6397b161/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index d3a3529..a6458dd 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -807,6 +807,8 @@ RecordElement RecordsConfig[] = {
   ,
   {RECT_CONFIG, "proxy.config.net.poll_timeout", RECD_INT, "10", RECU_NULL, RR_NULL, RECC_NULL,
NULL, RECA_NULL}
   ,
+  {RECT_CONFIG, "proxy.config.net.default_inactivity_timeout", RECD_INT, "86400", RECU_NULL,
RR_NULL, RECC_NULL, NULL, RECA_NULL}
+  ,
 
   //##############################################################################
   //#


Mime
View raw message