Skip to content
Snippets Groups Projects
Commit ad549098 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

proxyServer: use lockListener_ to protect pushListeners_

parent 6795ba38
Branches
Tags
No related merge requests found
...@@ -445,7 +445,6 @@ private: ...@@ -445,7 +445,6 @@ private:
std::map<InfoHash, std::vector<Listener>> listeners; std::map<InfoHash, std::vector<Listener>> listeners;
MSGPACK_DEFINE_ARRAY(listeners) MSGPACK_DEFINE_ARRAY(listeners)
}; };
std::mutex lockPushListeners_;
std::map<std::string, PushListener> pushListeners_; std::map<std::string, PushListener> pushListeners_;
proxy::ListenToken tokenPushNotif_ {0}; proxy::ListenToken tokenPushNotif_ {0};
#endif //OPENDHT_PUSH_NOTIFICATIONS #endif //OPENDHT_PUSH_NOTIFICATIONS
......
...@@ -822,7 +822,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request, ...@@ -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()); 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 // 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& pushListener = pushListeners_[pushToken];
auto& pushListeners = pushListener.listeners[infoHash]; auto& pushListeners = pushListener.listeners[infoHash];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment