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

proxy client: schedule connectCallbacks in callback queue

parent 7ba53cb4
No related merge requests found
......@@ -723,11 +723,16 @@ DhtProxyClient::onProxyInfos(const Json::Value& proxyInfos, const sa_family_t fa
if (oldStatus == NodeStatus::Disconnected || oldStatus == NodeStatus::Connecting) {
listenerRestartTimer_->expires_at(std::chrono::steady_clock::now());
listenerRestartTimer_->async_wait(std::bind(&DhtProxyClient::restartListeners, this, std::placeholders::_1));
if (not onConnectCallbacks_.empty()) {
std::lock_guard<std::mutex> lock(lockCallbacks_);
callbacks_.emplace_back([this] {
while (not onConnectCallbacks_.empty()) {
auto cb = std::move(onConnectCallbacks_.front());
onConnectCallbacks_.pop();
cb();
}
});
}
}
nextProxyConfirmationTimer_->expires_at(std::chrono::steady_clock::now() + std::chrono::minutes(15));
nextProxyConfirmationTimer_->async_wait(std::bind(&DhtProxyClient::handleProxyConfirm, this, std::placeholders::_1));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment