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>
// 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;
// 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;
}
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);