Skip to content
Snippets Groups Projects
Unverified Commit fcac10c4 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

proxyserver: fix cancelListen and reduce push notifications number

parent 22ef53ac
Branches
Tags
No related merge requests found
...@@ -343,7 +343,6 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co ...@@ -343,7 +343,6 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co
try { try {
restbed::Bytes buf(b); restbed::Bytes buf(b);
std::string strJson(buf.begin(), buf.end()); std::string strJson(buf.begin(), buf.end());
std::string err; std::string err;
Json::Value root; Json::Value root;
Json::CharReaderBuilder rbuilder; Json::CharReaderBuilder rbuilder;
...@@ -355,7 +354,7 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co ...@@ -355,7 +354,7 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co
} }
auto pushToken = root["key"].asString(); auto pushToken = root["key"].asString();
if (pushToken.empty()) return; if (pushToken.empty()) return;
auto token = root["token"].asLargestUInt(); auto token = std::stoull(root["token"].asString());
if (token == 0) return; if (token == 0) return;
auto callbackId = root.isMember("callback_id") ? root["callback_id"].asLargestUInt() : 0; auto callbackId = root.isMember("callback_id") ? root["callback_id"].asLargestUInt() : 0;
...@@ -430,7 +429,7 @@ DhtProxyServer::handlePushListeners() ...@@ -430,7 +429,7 @@ DhtProxyServer::handlePushListeners()
auto isAndroid = pushListener->isAndroid; auto isAndroid = pushListener->isAndroid;
auto clientId = pushListener->clientId; auto clientId = pushListener->clientId;
pushListener->internalToken = dht_->listen(pushListener->hash, pushListener->internalToken = dht_->listen(pushListener->hash,
[this, key, callbackId, token, isAndroid, clientId](std::shared_ptr<Value> /*value*/) { [this, key, callbackId, token, isAndroid, clientId](std::vector<std::shared_ptr<Value>> /*value*/) {
// Build message content. // Build message content.
Json::Value json; Json::Value json;
if (callbackId > 0) { if (callbackId > 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment