Skip to content

Commit

Permalink
Postponed listening to allow for too-early connect error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikolaj Malecki committed Jan 14, 2025
1 parent 92a9ece commit 36501a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/test_bonding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,6 @@ TEST(Bonding, ConnectNonBlocking)
EXPECT_NE(srt_bind(g_listen_socket, (sockaddr*)&bind_sa, sizeof bind_sa), -1);
const int yes = 1;
srt_setsockflag(g_listen_socket, SRTO_GROUPCONNECT, &yes, sizeof yes);
EXPECT_NE(srt_listen(g_listen_socket, 5), -1);

int lsn_eid = srt_epoll_create();
int lsn_events = SRT_EPOLL_IN | SRT_EPOLL_ERR | SRT_EPOLL_UPDATE;
Expand Down Expand Up @@ -764,6 +763,8 @@ TEST(Bonding, ConnectNonBlocking)
// Yield to allow the "too early" sending to fail
std::this_thread::yield();

EXPECT_NE(srt_listen(g_listen_socket, 5), -1);

// This can wait in infinity; worst case it will be killed in process.
int uwait_res = srt_epoll_uwait(lsn_eid, ev, 3, -1);
EXPECT_EQ(uwait_res, 1);
Expand Down

0 comments on commit 36501a0

Please sign in to comment.