diff options
| author | Stefan Boberg <[email protected]> | 2026-03-12 15:05:04 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-12 15:05:04 +0100 |
| commit | 81c87586690ef596561e257e1ddde274848199fd (patch) | |
| tree | 07a2edf8b0e2033603bd805f7d9ac192502e27f7 /src/zenhttp/servers/httpasio.cpp | |
| parent | Transparent proxy mode (#823) (diff) | |
| download | zen-81c87586690ef596561e257e1ddde274848199fd.tar.xz zen-81c87586690ef596561e257e1ddde274848199fd.zip | |
upgrade asio from 1.29.0 to 1.38.0 (#827)
Migrate removed deprecated APIs:
- io_service -> io_context
- io_service::work -> executor_work_guard
- resolver::query/iterator -> resolver::resolve() with results_type
- address::from_string() -> make_address()
---
Breaking Changes (1.33.0)
- deferred as default completion token — can omit token in coroutines: co_await socket.async_read_some(buf)
- cancel_after / cancel_at — timeout any async operation: co_await sock.async_read_some(buf, cancel_after(5s))
- Partial completion token adapters — as_tuple, redirect_error, bind_executor etc. composable via pipe: co_await (async_write(sock, buf) | as_tuple | cancel_after(10s))
- composed — simpler alternative to async_compose for stateful operation implementations
- co_composed moved out of experimental
1.35.0 — Allocator & Resolver
- Allocator constructors for io_context and thread_pool — control memory allocation for services, I/O objects, strands
- Configurable resolver thread pool ("resolver"/"threads")
- Timer heap pre-allocation ("timer"/"heap_reserve")
1.37.0 — Inline Executors & Reactor Tuning
- inline_executor — always executes inline (useful as completion executor)
- inline_or_executor<> — tries inline first, falls back to wrapped executor
- New dispatch/post/defer overloads that run a function on one executor and deliver result to a handler on another
- redirect_disposition — captures disposition into a variable (like redirect_error but generic)
- Reactor config: reset_edge_on_partial_read, use_eventfd, use_timerfd
Notable Fixes
- Resource leak in awaitable move assignment (1.37.0)
- Memory leak in SSL stream move assignment (1.37.0)
- Thread sanitizer issue in kqueue reactor (1.37.0)
- co_spawn non-reentrant completion handler fix (1.36.0)
- Windows file append mode fix (1.32.0)
- SSL engine move assignment leak (1.33.0)
Diffstat (limited to 'src/zenhttp/servers/httpasio.cpp')
| -rw-r--r-- | src/zenhttp/servers/httpasio.cpp | 24 |
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&) |