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

[BUG] Removed setting +W for a listener socket after accept ready #2732

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
21 changes: 6 additions & 15 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10851,6 +10851,11 @@ int srt::CUDT::processConnectRequest(const sockaddr_any& addr, CPacket& packet)

HLOGC(cnlog.Debug, log << CONID() << "processConnectRequest: received a connection request");

// NOTE (IMPORTANT!!!)
//
// The current CUDT object represents a LISTENER SOCKET to which
// the request was redirected from the receiver queue.

if (m_bClosing)
{
m_RejectReason = SRT_REJ_CLOSE;
Expand Down Expand Up @@ -11135,21 +11140,7 @@ int srt::CUDT::processConnectRequest(const sockaddr_any& addr, CPacket& packet)
}
}

if (result == 1)
{
// BUG! There is no need to update write-readiness on the listener socket once new connection is accepted.
// Only read-readiness has to be updated, but it is done so in the newConnection(..) function.
// See PR #1831 and issue #1667.
HLOGC(cnlog.Debug,
log << CONID() << "processConnectRequest: accepted connection, updating epoll to write-ready");

// New connection has been accepted or an existing one has been found. Update epoll write-readiness.
// a new connection has been created, enable epoll for write
// Note: not using SRT_EPOLL_CONNECT symbol because this is a procedure
// executed for the accepted socket.
uglobal().m_EPoll.update_events(m_SocketID, m_sPollID, SRT_EPOLL_OUT, true);
}
else if (result == -1)
if (result == -1)
{
// The new connection failed
// or the connection already existed, but manually sending the HS response above has failed.
Expand Down
4 changes: 2 additions & 2 deletions testing/testmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ void SrtCommon::PrepareListener(string host, int port, int backlog)

if (!m_blocking_mode)
{
srt_conn_epoll = AddPoller(m_bindsock, SRT_EPOLL_OUT);
srt_conn_epoll = AddPoller(m_bindsock, SRT_EPOLL_IN);
}

auto sa = CreateAddr(host, port);
Expand Down Expand Up @@ -547,7 +547,7 @@ void SrtCommon::AcceptNewClient()

int len = 2;
SRTSOCKET ready[2];
while (srt_epoll_wait(srt_conn_epoll, 0, 0, ready, &len, 1000, 0, 0, 0, 0) == -1)
while (srt_epoll_wait(srt_conn_epoll, ready, &len, 0, 0, 1000, 0, 0, 0, 0) == -1)
{
if (::transmit_int_state)
Error("srt_epoll_wait for srt_accept: interrupt");
Expand Down