Describe the bug
I have a thread that continuously accepts connections from a listener socket. The socket is configured in blocking mode, hence the only way to exit an srt_accept call is to close the socket. This results in this log always appearing when I shutdown my app:
17:38:38.926767/eveSrtTests*E:SRT.cn: srt_accept: listener socket @899642338 is already closed
To Reproduce
#include <chrono>
#include <future>
#include <iostream>
#include <thread>
#include <catch2/catch_test_macros.hpp>
#include <srt/srt.h>
TEST_CASE("srt_accept error")
{
REQUIRE(srt_startup() >= 0);
auto listener = srt_create_socket();
REQUIRE(listener != SRT_INVALID_SOCK);
sockaddr_in bindTarget;
bindTarget.sin_family = AF_INET;
bindTarget.sin_addr.s_addr = inet_addr("127.0.0.1");
bindTarget.sin_port = htons(0);
REQUIRE(srt_bind(listener, (sockaddr*)&bindTarget, sizeof(bindTarget)) == 0);
REQUIRE(srt_listen(listener, 1) == 0);
std::future<int> acceptFuture = std::async([listener] {
sockaddr_in sa;
int saLen = sizeof(sa);
std::ignore = srt_accept(listener, (sockaddr*)&sa, &saLen);
return srt_getlasterror(nullptr);
});
// Wait a bit to ensure srt_accept() is waiting on the accept.
std::this_thread::sleep_for(std::chrono::milliseconds(1'000));
REQUIRE(srt_close(listener) == 0);
int acceptError = acceptFuture.get();
CHECK((acceptError == SRT_EINVSOCK || acceptError == SRT_ESCLOSED));
std::ignore = srt_cleanup();
}
Expected behavior
As this is the intended use, I would not expect an error log to appear.
Suggestion
Could the log level be reduced to info (or removed since we already have the throw) if we're in blocking mode?
Describe the bug
I have a thread that continuously accepts connections from a listener socket. The socket is configured in blocking mode, hence the only way to exit an
srt_acceptcall is to close the socket. This results in this log always appearing when I shutdown my app:To Reproduce
Expected behavior
As this is the intended use, I would not expect an error log to appear.
Suggestion
Could the log level be reduced to info (or removed since we already have the throw) if we're in blocking mode?