mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
dhtproxy: remove sendSubscribe
This commit is contained in:
1 parent
70f09ded3f
commit
3a3933e6d5
3 files changed
+23
-96
No files matched your search
@@ -287,7 +287,7 @@ DhtProxyServer::get(const Sp<restbed::Session>& session) const
|
||||
Json::StreamWriterBuilder wbuilder;
|
||||
wbuilder["commentStyle"] = "None";
|
||||
wbuilder["indentation"] = "";
|
||||
auto output = Json::writeString(wbuilder, value->toJson()) + "\n";
|
||||
auto output = Json::writeString(wbuilder, value->toJson()) + "\n";
|
||||
s->yield(output, [](const Sp<restbed::Session>& /*session*/){ });
|
||||
return true;
|
||||
}, [s](bool /*ok* */) {
|
||||
@@ -428,6 +428,7 @@ DhtProxyServer::subscribe(const std::shared_ptr<restbed::Session>& session)
|
||||
if (listener.clientId == clientId) {
|
||||
scheduler_.edit(listener.expireJob, timeout);
|
||||
scheduler_.edit(listener.expireNotifyJob, timeout - proxy::OP_MARGIN);
|
||||
s->yield(restbed::OK);
|
||||
dht_->get(infoHash,
|
||||
[this, s](const Sp<Value>& value) {
|
||||
if (s->is_closed()) return false;
|
||||
@@ -441,8 +442,7 @@ DhtProxyServer::subscribe(const std::shared_ptr<restbed::Session>& session)
|
||||
}, [s](bool /*ok* */) {
|
||||
// Communication is finished
|
||||
if (not s->is_closed()) {
|
||||
std::cout << "X: " << std::endl;
|
||||
s->close();
|
||||
s->close("{}\n");
|
||||
}
|
||||
});
|
||||
schedulerCv_.notify_one();
|
||||
@@ -483,7 +483,6 @@ DhtProxyServer::subscribe(const std::shared_ptr<restbed::Session>& session)
|
||||
);
|
||||
}
|
||||
schedulerCv_.notify_one();
|
||||
std::cout << "CLOSE: " << std::endl;
|
||||
s->close(restbed::OK, "{}\n");
|
||||
} catch (...) {
|
||||
s->close(restbed::INTERNAL_SERVER_ERROR, "{\"err\":\"Internal server error\"}");
|
||||
|
||||
Reference in new issue
Block a user