proxy client: move callbacks to lambda

This commit is contained in:
Adrien Béraud committed 2021-04-16 15:04:19 -04:00
1 parent ae2445fd07
commit a24dedd225
1 file changed
+4 -4
+4 -4
View File
@@ -725,10 +725,10 @@ DhtProxyClient::onProxyInfos(const Json::Value& proxyInfos, const sa_family_t fa
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();
callbacks_.emplace_back([cbs = std::move(onConnectCallbacks_)]() mutable {
while (not cbs.empty()) {
auto cb = std::move(cbs.front());
cbs.pop();
cb();
}
});