]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: dec active connections when marked down
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 5 Apr 2019 23:04:14 +0000 (16:04 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 8 Apr 2019 18:42:12 +0000 (11:42 -0700)
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 <pdonnell@redhat.com>
src/msg/async/AsyncMessenger.cc
src/msg/async/AsyncMessenger.h

index 12d516a90f6e91248cfcbb614aad2f49e0c7604f..aad3ce53f3306b93ee0806a366d011166a7f8327 100644 (file)
@@ -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;
index 7189b59055238ce0f8d5ab6f521e5fdc76cfc073..1ce3640db356a8b18a1c443aa89ba5eb335772a9 100644 (file)
@@ -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);