Skip to content

Commit

Permalink
msg/async: dec active connections when marked down
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit d2d38ac)
  • Loading branch information
batrick authored and smithfarm committed Apr 25, 2019
1 parent 7f220e2 commit a2568f2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/msg/async/AsyncMessenger.cc
Expand Up @@ -860,7 +860,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;
Expand Down
2 changes: 1 addition & 1 deletion src/msg/async/AsyncMessenger.h
Expand Up @@ -315,7 +315,6 @@ class AsyncMessenger : public SimplePolicyMessenger {
// 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;
}
Expand Down Expand Up @@ -403,6 +402,7 @@ class AsyncMessenger : public SimplePolicyMessenger {
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);
Expand Down

0 comments on commit a2568f2

Please sign in to comment.