diff --git a/include/opendht/dht_proxy_server.h b/include/opendht/dht_proxy_server.h index 4e4938d3..c411eaec 100644 --- a/include/opendht/dht_proxy_server.h +++ b/include/opendht/dht_proxy_server.h @@ -339,6 +339,7 @@ private: using time_point = clock::time_point; std::shared_ptr dht_; + std::shared_ptr logger_; Json::StreamWriterBuilder jsonBuilder_; restinio::http_server_t httpServer_; diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp index 8f5a4603..ce05638e 100644 --- a/src/dht_proxy_server.cpp +++ b/src/dht_proxy_server.cpp @@ -50,9 +50,12 @@ struct DhtProxyServer::SearchPuts { constexpr const std::chrono::minutes PRINT_STATS_PERIOD {2}; constexpr const size_t IO_THREADS_MAX {64}; -DhtProxyServer::DhtProxyServer(std::shared_ptr dht, in_port_t port ,const std::string& pushServer, std::shared_ptr logger) -: dht_(dht), threadPool_(new ThreadPool(IO_THREADS_MAX)), pushServer_(pushServer), - httpServer_(restinio::own_io_context(), []( auto & settings ){}) +DhtProxyServer::DhtProxyServer(std::shared_ptr dht, in_port_t port , + const std::string& pushServer, + std::shared_ptr logger): + dht_(dht), logger_(logger), threadPool_(new ThreadPool(IO_THREADS_MAX)), + pushServer_(pushServer), + httpServer_(restinio::own_io_context(), []( auto & settings ){}) { if (not dht_) throw std::invalid_argument("A DHT instance must be provided"); @@ -640,6 +643,7 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso auto hostAndPort = splitPort(pushServer_); uint16_t port = std::atoi(hostAndPort.second.c_str()); http::Client httpClient {hostAndPort.first, port}; + httpClient.set_logger(logger_); auto parser = std::make_shared(); http_parser_init(parser.get(), HTTP_RESPONSE);