From ad549098f86cf371eb62c74373d42f9f846316c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Tue, 25 May 2021 16:02:34 -0400 Subject: [PATCH] proxyServer: use lockListener_ to protect pushListeners_ --- include/opendht/dht_proxy_server.h | 1 - src/dht_proxy_server.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/opendht/dht_proxy_server.h b/include/opendht/dht_proxy_server.h index 5dcc4193..3c8e806f 100644 --- a/include/opendht/dht_proxy_server.h +++ b/include/opendht/dht_proxy_server.h @@ -445,7 +445,6 @@ private: std::map<InfoHash, std::vector<Listener>> listeners; MSGPACK_DEFINE_ARRAY(listeners) }; - std::mutex lockPushListeners_; std::map<std::string, PushListener> pushListeners_; proxy::ListenToken tokenPushNotif_ {0}; #endif //OPENDHT_PUSH_NOTIFICATIONS diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index d1f801ca..cafe86e0 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -822,7 +822,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request, logger_->d("[proxy:server] [subscribe %s] [client %s] [session %s]", infoHash.toString().c_str(), clientId.c_str(), sessionId.c_str()); // Insert new or return existing push listeners of a token - std::lock_guard<std::mutex> lock(lockPushListeners_); + std::lock_guard<std::mutex> lock(lockListener_); auto& pushListener = pushListeners_[pushToken]; auto& pushListeners = pushListener.listeners[infoHash]; -- GitLab