aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/servers/httpasio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenhttp/servers/httpasio.cpp')
-rw-r--r--src/zenhttp/servers/httpasio.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/zenhttp/servers/httpasio.cpp b/src/zenhttp/servers/httpasio.cpp
index ee8e71256..e8b27da70 100644
--- a/src/zenhttp/servers/httpasio.cpp
+++ b/src/zenhttp/servers/httpasio.cpp
@@ -530,9 +530,9 @@ public:
int GetEffectiveHttpsPort() const;
- asio::io_service m_IoService;
- asio::io_service::work m_Work{m_IoService};
- std::unique_ptr<asio_http::HttpAcceptor> m_Acceptor;
+ asio::io_context m_IoService;
+ asio::executor_work_guard<asio::io_context::executor_type> m_Work{m_IoService.get_executor()};
+ std::unique_ptr<asio_http::HttpAcceptor> m_Acceptor;
#if defined(ASIO_HAS_LOCAL_SOCKETS)
std::unique_ptr<asio_http::UnixAcceptor> m_UnixAcceptor;
#endif
@@ -1507,7 +1507,7 @@ HttpServerConnectionT<SocketType>::HandleRequest()
struct TcpAcceptorBase
{
TcpAcceptorBase(HttpAsioServerImpl& Server,
- asio::io_service& IoService,
+ asio::io_context& IoService,
uint16_t BasePort,
bool ForceLoopback,
bool AllowPortProbing,
@@ -1580,7 +1580,7 @@ protected:
virtual void OnAccept(std::unique_ptr<asio::ip::tcp::socket> Socket) = 0;
HttpAsioServerImpl& m_Server;
- asio::io_service& m_IoService;
+ asio::io_context& m_IoService;
private:
template<typename AddressType>
@@ -1785,7 +1785,7 @@ private:
struct HttpAcceptor final : TcpAcceptorBase
{
- HttpAcceptor(HttpAsioServerImpl& Server, asio::io_service& IoService, uint16_t BasePort, bool ForceLoopback, bool AllowPortProbing)
+ HttpAcceptor(HttpAsioServerImpl& Server, asio::io_context& IoService, uint16_t BasePort, bool ForceLoopback, bool AllowPortProbing)
: TcpAcceptorBase(Server, IoService, BasePort, ForceLoopback, AllowPortProbing, "HTTP")
{
}
@@ -1810,7 +1810,7 @@ protected:
struct UnixAcceptor
{
- UnixAcceptor(HttpAsioServerImpl& Server, asio::io_service& IoService, const std::string& SocketPath)
+ UnixAcceptor(HttpAsioServerImpl& Server, asio::io_context& IoService, const std::string& SocketPath)
: m_Server(Server)
, m_IoService(IoService)
, m_Acceptor(m_IoService)
@@ -1897,7 +1897,7 @@ private:
}
HttpAsioServerImpl& m_Server;
- asio::io_service& m_IoService;
+ asio::io_context& m_IoService;
asio::local::stream_protocol::acceptor m_Acceptor;
std::string m_SocketPath;
bool m_IsValid{false};
@@ -1913,7 +1913,7 @@ private:
struct HttpsAcceptor final : TcpAcceptorBase
{
HttpsAcceptor(HttpAsioServerImpl& Server,
- asio::io_service& IoService,
+ asio::io_context& IoService,
asio::ssl::context& SslContext,
uint16_t Port,
bool ForceLoopback,
@@ -2284,7 +2284,7 @@ HttpAsioServerImpl::Stop()
// Drain remaining handlers (e.g. cancellation callbacks from active WebSocket
// connections) so that their captured Ref<> pointers are released while the
- // io_service and its epoll reactor are still alive. Without this, sockets
+ // io_context and its epoll reactor are still alive. Without this, sockets
// held by external code (e.g. IWebSocketHandler connection lists) can outlive
// the reactor and crash during deregistration.
m_IoService.restart();
@@ -2486,9 +2486,9 @@ HttpAsioServer::OnGetExternalHost() const
// causes the OS to select the appropriate local interface without sending any data.
try
{
- asio::io_service IoService;
+ asio::io_context IoService;
asio::ip::udp::socket Sock(IoService, asio::ip::udp::v4());
- Sock.connect(asio::ip::udp::endpoint(asio::ip::address::from_string("8.8.8.8"), 80));
+ Sock.connect(asio::ip::udp::endpoint(asio::ip::make_address("8.8.8.8"), 80));
return Sock.local_endpoint().address().to_string();
}
catch (const std::exception&)