Skip to content

Commit

Permalink
peer discovery: re-publish and re-discover immediately when a node di…
Browse files Browse the repository at this point in the history
…sconnects, instead of on the connectivityChanged signal.
  • Loading branch information
AmnaSnene committed Jun 21, 2024
1 parent 313b69d commit 47724bb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/dhtrunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ DhtRunner::run(const Config& config, Context&& context)
}
}
}
if (config.peer_discovery && config.peer_publish) {
context.statusChangedCallback = [this](NodeStatus status4, NodeStatus status6) {
if (status4 == NodeStatus::Disconnected && status6 == NodeStatus::Disconnected) {
peerDiscovery_->connectivityChanged();
}
};
}
#endif
}
}
Expand Down Expand Up @@ -1039,10 +1046,6 @@ DhtRunner::connectivityChanged()
std::lock_guard<std::mutex> lck(storage_mtx);
pending_ops_prio.emplace([=](SecureDht& dht) {
dht.connectivityChanged();
#ifdef OPENDHT_PEER_DISCOVERY
if (peerDiscovery_)
peerDiscovery_->connectivityChanged();
#endif
});
cv.notify_all();
}
Expand Down

0 comments on commit 47724bb

Please sign in to comment.