diff --git a/src/dht_proxy_client.cpp b/src/dht_proxy_client.cpp index 5f4e99f3..ab7b86cd 100644 --- a/src/dht_proxy_client.cpp +++ b/src/dht_proxy_client.cpp @@ -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 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(); } });