From 709a92a69d54e077e97f194e7e7e863b66f93248 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Fri, 19 Jun 2026 13:18:29 +0200 Subject: [PATCH] Fixes a race condition in test_push_consumer (test_conn_push2.cpp) --- test/test_conn_push2.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/test_conn_push2.cpp b/test/test_conn_push2.cpp index c76191dd..d089b208 100644 --- a/test/test_conn_push2.cpp +++ b/test/test_conn_push2.cpp @@ -526,7 +526,12 @@ void test_push_consumer() if (ec) { BOOST_TEST_EQ(ec, net::error::operation_aborted); push_consumer_finished = true; - resp.clear(); + return; + } else if (!conn.will_reconnect()) { + // The connection might be cancelled after async_receive2 is scheduled + // for completion, but before the callback is called. An equivalent clause + // is also present in the examples. + push_consumer_finished = true; return; } launch_push_consumer();