messaging: do not delete client during messaging service shutdown

Messaging service stop() method calls stop() on all clients. If
remove_rpc_client_one() is called while those stops are running
client::stop() will be called twice which not suppose to happen. Fix it
by ignoring client remove request during messaging service shutdown.

Fixes #1059

Message-Id: <1458639452-29388-2-git-send-email-gleb@scylladb.com>
This commit is contained in:
Gleb Natapov
2016-03-22 11:37:31 +02:00
committed by Avi Kivity
parent b8abd88841
commit 357c91a076
Notes: Avi Kivity 2016-03-26 22:06:40 +03:00
backport: 1.0

View File

@@ -409,6 +409,13 @@ shared_ptr<messaging_service::rpc_protocol_client_wrapper> messaging_service::ge
}
void messaging_service::remove_rpc_client_one(clients_map& clients, msg_addr id, bool dead_only) {
if (_stopping) {
// if messaging service is in a processed of been stopped no need to
// stop and remove connection here since they are being stopped already
// and we'll just interfere
return;
}
auto it = clients.find(id);
if (it != clients.end() && (!dead_only || it->second.rpc_client->error())) {
auto client = std::move(it->second.rpc_client);