Skip to content

Commit

Permalink
[tests] Prevent socket from being closed twice in EE test (#2886).
Browse files Browse the repository at this point in the history
  • Loading branch information
ethouris committed Feb 21, 2024
1 parent 07e22ca commit 6b75145
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/test_enforced_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,16 @@ class TestEnforcedEncryption
{
// Code here will be called just after the test completes.
// OK to throw exceptions from here if needed.
EXPECT_NE(srt_close(m_caller_socket), SRT_ERROR) << srt_getlasterror_str();
EXPECT_NE(srt_close(m_listener_socket), SRT_ERROR) << srt_getlasterror_str();

if (m_caller_socket != SRT_INVALID_SOCK)
{
EXPECT_NE(srt_close(m_caller_socket), SRT_ERROR) << srt_getlasterror_str();
}

if (m_listener_socket != SRT_INVALID_SOCK)
{
EXPECT_NE(srt_close(m_listener_socket), SRT_ERROR) << srt_getlasterror_str();
}
}


Expand Down Expand Up @@ -541,6 +549,7 @@ class TestEnforcedEncryption
// Just give it some time and close the socket.
std::this_thread::sleep_for(std::chrono::milliseconds(50));
ASSERT_NE(srt_close(m_listener_socket), SRT_ERROR);
m_listener_socket = SRT_INVALID_SOCK; // mark closed already
accepting_thread.join();
}
}
Expand Down

0 comments on commit 6b75145

Please sign in to comment.