This commit is contained in:
ldcsaa 2024-01-30 22:19:22 +08:00
parent 2cfffd763d
commit 0f3e8a4ffb
2 changed files with 5 additions and 21 deletions

View File

@ -228,7 +228,7 @@ BOOL CUdpNode::StartAccept()
{
SOCKET& soListen = m_soListens[i];
if(!m_ioDispatcher.AddFD(i, soListen, EPOLLIN | EPOLLET, TO_PVOID(&soListen)))
if(!m_ioDispatcher.AddFD(i, soListen, EPOLLIN | EPOLLOUT | EPOLLET, TO_PVOID(&soListen)))
return FALSE;
}
@ -603,12 +603,7 @@ BOOL CUdpNode::HandleReceive(const TDispContext* pContext, int flag)
BOOL CUdpNode::HandleSend(const TDispContext* pContext, int flag, int rd)
{
int idx = pContext->GetIndex();
SOCKET& soListen = m_soListens[idx];
m_ioDispatcher.ModFD(soListen, EPOLLIN | EPOLLET, TO_PVOID(&soListen));
HandleCmdSend(idx, flag);
HandleCmdSend(pContext->GetIndex(), flag);
return TRUE;
}
@ -640,9 +635,6 @@ VOID CUdpNode::HandleCmdSend(int idx, int flag)
sndBuff.PushFront(bufPtr.Detach());
}
SOCKET& soListen = m_soListens[idx];
m_ioDispatcher.ModFD(soListen, EPOLLOUT | EPOLLIN | EPOLLET, TO_PVOID(&soListen));
break;
}
}

View File

@ -186,7 +186,7 @@ BOOL CUdpServer::StartAccept()
{
SOCKET& soListen = m_soListens[i];
if(!m_ioDispatcher.AddFD(i, soListen, EPOLLIN | EPOLLET, TO_PVOID(&soListen)))
if(!m_ioDispatcher.AddFD(i, soListen, EPOLLIN | EPOLLOUT | EPOLLET, TO_PVOID(&soListen)))
return FALSE;
}
@ -966,13 +966,8 @@ void CUdpServer::HandleZeroBytes(TUdpSocketObj* pSocketObj)
BOOL CUdpServer::HandleSend(const TDispContext* pContext, int flag)
{
int idx = pContext->GetIndex();
SOCKET& soListen = m_soListens[idx];
CSendQueue& quSend = m_quSends[idx];
m_ioDispatcher.ModFD(soListen, EPOLLIN | EPOLLET, TO_PVOID(&soListen));
CONNID dwConnID = 0;
CSendQueue& quSend = m_quSends[pContext->GetIndex()];
CONNID dwConnID = 0;
while(quSend.PopFront(&dwConnID))
HandleCmdSend(dwConnID, flag);
@ -1017,9 +1012,6 @@ VOID CUdpServer::HandleCmdSend(CONNID dwConnID, int flag)
m_quSends[pSocketObj->index].PushBack(dwConnID);
SOCKET& soListen = m_soListens[pSocketObj->index];
m_ioDispatcher.ModFD(soListen, EPOLLOUT | EPOLLIN | EPOLLET, TO_PVOID(&soListen));
break;
}
}