Skip to content

Commit

Permalink
[tests] strict encyption: debug trace torned off
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Sep 13, 2019
1 parent a9d7153 commit d2836c7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions test/test_strict_encription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,26 +368,25 @@ class TestStrictEncryption
EXPECT_EQ(GetSocetkOption(accepted_socket, SRTO_SNDKMSTATE), expect.km_state[CHECK_SOCKET_ACCEPTED]);
if (m_is_tracing)
{
std::cout << "Socket state accepted: " << m_socket_state[srt_getsockstate(accepted_socket)] << "\n";
std::cout << "KM State accepted: " << m_km_state[GetKMState(accepted_socket)] << '\n';
std::cout << "RCV KM State accepted: " << m_km_state[GetSocetkOption(accepted_socket, SRTO_RCVKMSTATE)] << '\n';
std::cout << "SND KM State accepted: " << m_km_state[GetSocetkOption(accepted_socket, SRTO_SNDKMSTATE)] << '\n';
std::cerr << "Socket state accepted: " << m_socket_state[srt_getsockstate(accepted_socket)] << "\n";
std::cerr << "KM State accepted: " << m_km_state[GetKMState(accepted_socket)] << '\n';
std::cerr << "RCV KM State accepted: " << m_km_state[GetSocetkOption(accepted_socket, SRTO_RCVKMSTATE)] << '\n';
std::cerr << "SND KM State accepted: " << m_km_state[GetSocetkOption(accepted_socket, SRTO_SNDKMSTATE)] << '\n';
}
}
std::cout << "srt_accept() thread finished\n";
});

if (is_blocking == false)
accepting_thread.join();

if (m_is_tracing)
{
std::cout << "Socket state caller: " << m_socket_state[srt_getsockstate(m_caller_socket)] << "\n";
std::cout << "Socket state listener: " << m_socket_state[srt_getsockstate(m_listener_socket)] << "\n";
std::cout << "KM State caller: " << m_km_state[GetKMState(m_caller_socket)] << '\n';
std::cout << "RCV KM State caller: " << m_km_state[GetSocetkOption(m_caller_socket, SRTO_RCVKMSTATE)] << '\n';
std::cout << "SND KM State caller: " << m_km_state[GetSocetkOption(m_caller_socket, SRTO_SNDKMSTATE)] << '\n';
std::cout << "KM State listener: " << m_km_state[GetKMState(m_listener_socket)] << '\n';
std::cerr << "Socket state caller: " << m_socket_state[srt_getsockstate(m_caller_socket)] << "\n";
std::cerr << "Socket state listener: " << m_socket_state[srt_getsockstate(m_listener_socket)] << "\n";
std::cerr << "KM State caller: " << m_km_state[GetKMState(m_caller_socket)] << '\n';
std::cerr << "RCV KM State caller: " << m_km_state[GetSocetkOption(m_caller_socket, SRTO_RCVKMSTATE)] << '\n';
std::cerr << "SND KM State caller: " << m_km_state[GetSocetkOption(m_caller_socket, SRTO_SNDKMSTATE)] << '\n';
std::cerr << "KM State listener: " << m_km_state[GetKMState(m_listener_socket)] << '\n';
}

// If a blocking call to srt_connect() returned error, then the state is not valid,
Expand All @@ -403,7 +402,6 @@ class TestStrictEncryption
// srt_accept() has no timeout, so we have to close the socket and wait for the thread to exit.
// Just give it some time and close the socket.
std::this_thread::sleep_for(std::chrono::milliseconds(50));
std::cout << "Closing the listener socket\n";
ASSERT_NE(srt_close(m_listener_socket), SRT_ERROR);
accepting_thread.join();
}
Expand All @@ -421,7 +419,7 @@ class TestStrictEncryption
const int s_yes = 1;
const int s_no = 0;

const bool m_is_tracing = true;
const bool m_is_tracing = false;
static const char* m_km_state[];
static const char* m_socket_state[];
};
Expand Down

0 comments on commit d2836c7

Please sign in to comment.