diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index 9373405f651..5ebd029f9ac 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -897,7 +897,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 3da42ab3aeb..fc17b93cd19 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(); @@ -1318,7 +1321,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(); @@ -1393,10 +1395,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(sslNetProcessor.allocate_vc(t));