From cce9f80f2c6fa59bd91d85f1fb9201a3edc3bdf9 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 4 Sep 2026 22:57:18 +0200 Subject: [PATCH] fix tcp::socket::cancel() --- src/tcp_socket.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tcp_socket.cpp b/src/tcp_socket.cpp index 173de68..daad886 100644 --- a/src/tcp_socket.cpp +++ b/src/tcp_socket.cpp @@ -307,6 +307,12 @@ namespace ip { post(m_io_service, aux::make_malloc(std::bind(std::move(m_connect_handler) , boost::system::error_code(error::operation_aborted)))); m_connect_handler = nullptr; + + // close() uses m_connect_handler as its sole signal for whether + // m_channel is an established connection vs. still routed to the + // acceptor; clear it here too, or a later close() call is fooled + // into treating this channel as established. + m_channel.reset(); } }