From f563217a8d649c951e5f2962411247dd452bb9d3 Mon Sep 17 00:00:00 2001 From: na-trium-144 <100704180+na-trium-144@users.noreply.github.com> Date: Tue, 17 Dec 2024 04:45:31 +0900 Subject: [PATCH] fix build errors and warnings --- include/crow/routing.h | 2 +- include/crow/socket_acceptors.h | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/crow/routing.h b/include/crow/routing.h index 536c9ad95..aaaa0df35 100644 --- a/include/crow/routing.h +++ b/include/crow/routing.h @@ -473,7 +473,7 @@ namespace crow // NOTE: Already documented in "crow/app.h" void handle_upgrade(const request& req, response&, UnixSocketAdaptor&& adaptor) override { max_payload_ = max_payload_override_ ? max_payload_ : app_->websocket_max_payload(); - new crow::websocket::Connection(req, std::move(adaptor), app_, max_payload_, open_handler_, message_handler_, close_handler_, error_handler_, accept_handler_); + new crow::websocket::Connection(req, std::move(adaptor), app_, max_payload_, subprotocols_, open_handler_, message_handler_, close_handler_, error_handler_, accept_handler_); } #ifdef CROW_ENABLE_SSL void handle_upgrade(const request& req, response&, SSLAdaptor&& adaptor) override diff --git a/include/crow/socket_acceptors.h b/include/crow/socket_acceptors.h index 91e62ceb3..db31f3133 100644 --- a/include/crow/socket_acceptors.h +++ b/include/crow/socket_acceptors.h @@ -13,8 +13,8 @@ namespace crow { using endpoint = tcp::endpoint; tcp::acceptor acceptor_; - TCPAcceptor(asio::io_service& io_service, const endpoint& endpoint): - acceptor_(io_service, endpoint) {} + TCPAcceptor(asio::io_service& io_service, const endpoint& endpoint_): + acceptor_(io_service, endpoint_) {} int16_t port() const { @@ -28,14 +28,18 @@ namespace crow { return acceptor_; } + endpoint local_endpoint() const + { + return acceptor_.local_endpoint(); + } }; struct UnixSocketAcceptor { using endpoint = stream_protocol::endpoint; stream_protocol::acceptor acceptor_; - UnixSocketAcceptor(asio::io_service& io_service, const endpoint& endpoint): - acceptor_(io_service, endpoint, false) {} + UnixSocketAcceptor(asio::io_service& io_service, const endpoint& endpoint_): + acceptor_(io_service, endpoint_, false) {} // reuse addr must be false (https://github.com/chriskohlhoff/asio/issues/622) int16_t port() const @@ -50,5 +54,9 @@ namespace crow { return acceptor_; } + endpoint local_endpoint() const + { + return acceptor_.local_endpoint(); + } }; } // namespace crow \ No newline at end of file