Skip to content

Commit

Permalink
Fixed initialization problem in SocketKeeper version with acquire
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikolaj Malecki committed Sep 9, 2024
1 parent ab000e3 commit ba582c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions srtcore/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,11 @@ class CUDTUnited
bool acquire(CUDTUnited& glob, CUDTSocket* s)
{
if (s == NULL)
{
socket = NULL;
return false;
}

const bool caught = glob.acquireSocket(s);
socket = caught ? s : NULL;
return caught;
Expand Down
11 changes: 7 additions & 4 deletions test/test_bonding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,17 @@ TEST(Bonding, InitialFailure)
char outbuf[1316];
SRT_MSGCTRL mc = srt_msgctrl_default;
int recvlen = srt_recvmsg2(gs, outbuf, 1316, &mc);
EXPECT_EQ(recvlen, packet_data.size());
outbuf[recvlen] = 0;
EXPECT_EQ(recvlen, int(packet_data.size()));

EXPECT_EQ(outbuf, packet_data);
if (recvlen > 0)
{
outbuf[recvlen] = 0;
EXPECT_EQ(outbuf, packet_data);
}
EXPECT_EQ(mc.pktseq, lsn_isn);

recvlen = srt_recv(gs, outbuf, 80);
EXPECT_EQ(recvlen, SRT_ERROR);
EXPECT_EQ(recvlen, int(SRT_ERROR));

srt_close(gs);
srt_close(grp);
Expand Down

0 comments on commit ba582c3

Please sign in to comment.