mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
http: merge on_message_complete into on_state_change callback
This commit is contained in:
1 parent
692304c2e3
commit
de9e0906de
5 files changed
+128
-172
No files matched your search
@@ -699,14 +699,13 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso
|
||||
auto body = Json::writeString(wbuilder, content);
|
||||
request->set_body(body);
|
||||
|
||||
request->add_on_message_complete_callback([this, reqid](const http::Response response){
|
||||
if (response.status_code != 200)
|
||||
if (logger_)
|
||||
request->add_on_state_change_callback([this, reqid]
|
||||
(const http::Request::State state, const http::Response response){
|
||||
if (state == http::Request::State::DONE){
|
||||
if (logger_ and response.status_code != 200)
|
||||
logger_->e("[proxy:server] [notification] push failed: %i", response.status_code);
|
||||
});
|
||||
request->add_on_state_changed_callback([this, reqid](const http::Request::State state){
|
||||
if (state == http::Request::State::DONE)
|
||||
requests_.erase(reqid);
|
||||
}
|
||||
});
|
||||
request->send();
|
||||
requests_[reqid] = request;
|
||||
|
||||
Reference in new issue
Block a user