Skip to content
Snippets Groups Projects
Commit c8a0b443 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

dhtrunner: force execution of pending ops on shutdown

parent 00e595d7
Branches
Tags 2.2.1rc1
No related merge requests found
...@@ -294,6 +294,11 @@ DhtRunner::shutdown(ShutdownCallback cb, bool stop) { ...@@ -294,6 +294,11 @@ DhtRunner::shutdown(ShutdownCallback cb, bool stop) {
if (dht_) if (dht_)
dht_->shutdown(onShutdown, stop); dht_->shutdown(onShutdown, stop);
}); });
// Force execution of pending ops
if (getStatus() == NodeStatus::Connecting) {
status4 = NodeStatus::Disconnected;
status6 = NodeStatus::Disconnected;
}
cv.notify_all(); cv.notify_all();
} }
...@@ -368,6 +373,7 @@ DhtRunner::join() ...@@ -368,6 +373,7 @@ DhtRunner::join()
{ {
std::lock_guard<std::mutex> lck(dht_mtx); std::lock_guard<std::mutex> lck(dht_mtx);
resetDht(); resetDht();
std::lock_guard<std::mutex> lck2(storage_mtx);
status4 = NodeStatus::Disconnected; status4 = NodeStatus::Disconnected;
status6 = NodeStatus::Disconnected; status6 = NodeStatus::Disconnected;
} }
...@@ -703,8 +709,11 @@ DhtRunner::loop_() ...@@ -703,8 +709,11 @@ DhtRunner::loop_()
NodeStatus nstatus4 = dht->updateStatus(AF_INET); NodeStatus nstatus4 = dht->updateStatus(AF_INET);
NodeStatus nstatus6 = dht->updateStatus(AF_INET6); NodeStatus nstatus6 = dht->updateStatus(AF_INET6);
if (nstatus4 != status4 || nstatus6 != status6) { if (nstatus4 != status4 || nstatus6 != status6) {
{
std::lock_guard<std::mutex> lck(storage_mtx);
status4 = nstatus4; status4 = nstatus4;
status6 = nstatus6; status6 = nstatus6;
}
if (statusCb) if (statusCb)
statusCb(status4, status6); statusCb(status4, status6);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment