File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -5167,8 +5167,14 @@ TEST(KeepAliveTest, SSLClientReconnectionPost) {
51675167 res.set_content (" Hello World!" , " text/plain" );
51685168 });
51695169
5170- auto f = std::async (std::launch::async, [&svr] { svr.listen (HOST, PORT); });
5171- std::this_thread::sleep_for (std::chrono::milliseconds (200 ));
5170+ auto listen_thread = std::thread ([&svr] { svr.listen (HOST, PORT); });
5171+ auto se = detail::scope_exit ([&] {
5172+ svr.stop ();
5173+ listen_thread.join ();
5174+ ASSERT_FALSE (svr.is_running ());
5175+ });
5176+
5177+ svr.wait_until_ready ();
51725178
51735179 SSLClient cli (HOST, PORT);
51745180 cli.enable_server_certificate_verification (false );
@@ -5206,9 +5212,6 @@ TEST(KeepAliveTest, SSLClientReconnectionPost) {
52065212 " text/plain" );
52075213 ASSERT_TRUE (result);
52085214 EXPECT_EQ (200 , result->status );
5209-
5210- svr.stop ();
5211- f.wait ();
52125215}
52135216#endif
52145217
You can’t perform that action at this time.
0 commit comments