proxy_server: return old values when resubscribe

This commit is contained in:
Sébastien Blin authored and Adrien Béraud committed 2019-01-14 10:53:08 -08:00
1 parent e5b56cc0a5
commit 824a1bf5fa
1 file changed
+9
+9
View File
@@ -430,6 +430,15 @@ DhtProxyServer::subscribe(const std::shared_ptr<restbed::Session>& session)
scheduler_.edit(listener.expireNotifyJob, timeout - proxy::OP_MARGIN);
s->close(restbed::OK, "{}\n");
schedulerCv_.notify_one();
dht_->get(infoHash,
[this, infoHash, pushToken, isAndroid, clientId](std::vector<std::shared_ptr<Value>> /*value*/) {
// Build message content.
Json::Value json;
json["key"] = infoHash.toString();
json["to"] = clientId;
sendPushNotification(pushToken, json, isAndroid);
return true;
}, [](bool /*ok* */) {});
return;
}
}