Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Prevent socket from being closed twice in EE test #2886

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading