diff --git a/srtcore/core.cpp b/srtcore/core.cpp index 084cad670..325cc305b 100644 --- a/srtcore/core.cpp +++ b/srtcore/core.cpp @@ -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; @@ -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. diff --git a/testing/testmedia.cpp b/testing/testmedia.cpp index a4e74fffb..91a6c679e 100755 --- a/testing/testmedia.cpp +++ b/testing/testmedia.cpp @@ -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); @@ -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");