From: Patrick Donnelly Date: Fri, 5 Apr 2019 23:04:14 +0000 (-0700) Subject: msg/async: dec active connections when marked down X-Git-Tag: v15.1.0~2996^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d2d38ac858cb6d01b2744d2c0e3b6c0b532470d2;p=ceph-ci.git msg/async: dec active connections when marked down Otherwise, tests can't tell when a connection is stopped until it's eventually "lazily" deleted. This should be safe since the perf counter is manipulating an atomic value. Signed-off-by: Patrick Donnelly --- diff --git a/src/msg/async/AsyncMessenger.cc b/src/msg/async/AsyncMessenger.cc index 12d516a90f6..aad3ce53f33 100644 --- a/src/msg/async/AsyncMessenger.cc +++ b/src/msg/async/AsyncMessenger.cc @@ -856,7 +856,6 @@ int AsyncMessenger::accept_conn(AsyncConnectionRef conn) // If conn already in, we will return 0 Mutex::Locker l(deleted_lock); if (deleted_conns.erase(existing)) { - existing->get_perf_counter()->dec(l_msgr_active_connections); conns.erase(it); } else if (conn != existing) { return -1; diff --git a/src/msg/async/AsyncMessenger.h b/src/msg/async/AsyncMessenger.h index 7189b590552..1ce3640db35 100644 --- a/src/msg/async/AsyncMessenger.h +++ b/src/msg/async/AsyncMessenger.h @@ -314,7 +314,6 @@ private: // lazy delete, see "deleted_conns" Mutex::Locker l(deleted_lock); if (deleted_conns.erase(p->second)) { - p->second->get_perf_counter()->dec(l_msgr_active_connections); conns.erase(p); return NULL; } @@ -403,6 +402,7 @@ public: void unregister_conn(AsyncConnectionRef conn) { Mutex::Locker l(deleted_lock); deleted_conns.insert(conn); + conn->get_perf_counter()->dec(l_msgr_active_connections); if (deleted_conns.size() >= ReapDeadConnectionThreshold) { local_worker->center.dispatch_event_external(reap_handler);