You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/05/20 23:10:57 UTC

[trafficserver] 01/28: TS-4187: Keep the currently_open connections in sync with the number of sockets open. This closes #583.

This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 1df7e4b04a930b936b3185bcf2b3f88d8694cf08
Author: Susan Hinrichs <sh...@ieee.org>
AuthorDate: Fri Apr 15 16:34:25 2016 +0000

    TS-4187: Keep the currently_open connections in sync with the number of sockets open. This closes #583.
    
    (cherry picked from commit 6f1119222126db29e508104f88782b2478972bdf)
---
 iocore/net/SSLNetVConnection.cc  | 1 -
 iocore/net/UnixNetVConnection.cc | 8 +++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index a8388ad..5a96db4 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -885,7 +885,6 @@ SSLNetVConnection::do_io_close(int lerrno)
 void
 SSLNetVConnection::free(EThread *t)
 {
-  NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, -1);
   got_remote_addr = 0;
   got_local_addr = 0;
   read.vio.mutex.clear();
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index 593bf69..59b30bd 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -97,6 +97,9 @@ net_activity(UnixNetVConnection *vc, EThread *thread)
 void
 close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t)
 {
+  if (vc->con.fd != NO_FD) {
+    NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, -1);
+  }
   NetHandler *nh = vc->nh;
   vc->cancel_OOB();
   vc->ep.stop();
@@ -1324,7 +1327,6 @@ void
 UnixNetVConnection::free(EThread *t)
 {
   ink_release_assert(t == this_ethread());
-  NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, -1);
   // clear variables for reuse
   this->mutex.clear();
   action_.mutex.clear();
@@ -1399,10 +1401,6 @@ UnixNetVConnection::migrateToCurrentThread(Continuation *cont, EThread *t)
   this->ep.stop();
   this->do_io_close();
 
-  // The do_io_close will decrement the current stat count but we are creating a new vc.
-  // Increment the currently open stat here so the net current count is unchanged
-  NET_SUM_GLOBAL_DYN_STAT(net_connections_currently_open_stat, 1);
-
   // Create new VC:
   if (save_ssl) {
     SSLNetVConnection *sslvc = static_cast<SSLNetVConnection *>(sslNetProcessor.allocate_vc(t));

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.