From a24dedd225cd4976c42f78c60ec42c645aebdc3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Fri, 16 Apr 2021 15:04:19 -0400
Subject: [PATCH] proxy client: move callbacks to lambda

---
 src/dht_proxy_client.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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<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();
                     }
                 });
-- 
GitLab