Skip to content
Snippets Groups Projects
Commit eb4213d3 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

swarm_manager: avoid deadlock in shutdown

shutdown can cause the needSocketCb_ to pass a null socket. In this
case we can directly return instead of locking

GitLab: #995
Change-Id: I8ad744e494ea0bd3fe15f221a09feeb44e9aec83
parent fd2f2815
No related branches found
No related tags found
No related merge requests found
...@@ -339,7 +339,7 @@ SwarmManager::tryConnect(const NodeId& nodeId) ...@@ -339,7 +339,7 @@ SwarmManager::tryConnect(const NodeId& nodeId)
needSocketCb_(nodeId.toString(), needSocketCb_(nodeId.toString(),
[w = weak(), nodeId](const std::shared_ptr<dhtnet::ChannelSocketInterface>& socket) { [w = weak(), nodeId](const std::shared_ptr<dhtnet::ChannelSocketInterface>& socket) {
auto shared = w.lock(); auto shared = w.lock();
if (!shared) if (!shared || shared->isShutdown_)
return true; return true;
if (socket) { if (socket) {
shared->addChannel(socket); shared->addChannel(socket);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment