From fcac10c4c8c8b64997b93c993d0e2178bae58dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Blin?= <sebastien.blin@savoirfairelinux.com> Date: Mon, 26 Feb 2018 17:01:23 -0500 Subject: [PATCH] proxyserver: fix cancelListen and reduce push notifications number --- src/dht_proxy_server.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index a662f4d4..497609ab 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -343,7 +343,6 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co try { restbed::Bytes buf(b); std::string strJson(buf.begin(), buf.end()); - std::string err; Json::Value root; Json::CharReaderBuilder rbuilder; @@ -355,7 +354,7 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co } auto pushToken = root["key"].asString(); if (pushToken.empty()) return; - auto token = root["token"].asLargestUInt(); + auto token = std::stoull(root["token"].asString()); if (token == 0) return; auto callbackId = root.isMember("callback_id") ? root["callback_id"].asLargestUInt() : 0; @@ -430,7 +429,7 @@ DhtProxyServer::handlePushListeners() auto isAndroid = pushListener->isAndroid; auto clientId = pushListener->clientId; 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. Json::Value json; if (callbackId > 0) { -- GitLab