File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,16 +39,24 @@ class PerfdataWriterTargetFixture
3939 explicit PerfdataWriterTargetFixture (AsioTlsOrTcpStream stream)
4040 : m_Stream(std::move(stream)),
4141 m_Acceptor(
42- IoEngine::Get ().GetIoContext(),
43- boost::asio::ip::tcp::endpoint{boost::asio::ip::address_v4::loopback (), 0 }
42+ IoEngine::Get ().GetIoContext()
4443 )
4544 {
45+ boost::asio::ip::tcp::endpoint ep{boost::asio::ip::address_v4::loopback (), 0 };
46+ m_Acceptor.open (ep.protocol ());
47+ m_Acceptor.bind (ep);
4648 }
4749
4850 unsigned short GetPort () { return m_Acceptor.local_endpoint ().port (); }
4951
52+ void Listen ()
53+ {
54+ m_Acceptor.listen ();
55+ }
56+
5057 void Accept ()
5158 {
59+ Listen ();
5260 BOOST_REQUIRE_NO_THROW (
5361 std::visit ([&](auto & stream) { return m_Acceptor.accept (stream->lowest_layer ()); }, m_Stream)
5462 );
Original file line number Diff line number Diff line change @@ -130,10 +130,9 @@ BOOST_AUTO_TEST_CASE(finish_during_timeout)
130130 */
131131BOOST_AUTO_TEST_CASE (stuck_in_handshake)
132132{
133- TestThread mockTargetThread{[&]() { Accept (); }};
134-
135133 std::promise<void > p;
136134 TestThread timeoutThread{[&]() {
135+ Accept ();
137136 auto f = p.get_future ();
138137 GetConnection ().CancelAfterTimeout (f, 50ms);
139138 BOOST_REQUIRE (f.wait_for (0ms) == std::future_status::timeout);
@@ -144,7 +143,6 @@ BOOST_AUTO_TEST_CASE(stuck_in_handshake)
144143 );
145144
146145 REQUIRE_JOINS_WITHIN (timeoutThread, 1s);
147- REQUIRE_JOINS_WITHIN (mockTargetThread, 1s);
148146}
149147
150148/* When the disconnect timeout runs out while sending something to a slow or blocking server, we
You can’t perform that action at this time.
0 commit comments