rendered paste bodyvoid SocketManager::Debug_CheckSockets()
{
m_Mutex.Lock();
SocketBase* pSocket = NULL;
for(SocketSet::iterator itSocket = m_sockets.begin(); itSocket != m_sockets.end(); ++itSocket)
{
pSocket = (*itSocket);
if(!pSocket->IsConnected() || pSocket->IsMarkedAsDisconnected())
continue;
if(!event_pending(&pSocket->m_ev_read, EV_READ|EV_WRITE, NULL))
{
sLog.outError("DEBUG: forcibly add_event(EV_READ)");
if(LISTEN_S == pSocket->GetType())
{
#ifdef WIN32
timeval tv = {0, 50000};
#else
timeval tv = {5, 0};
#endif
if(event_add(&pSocket->m_ev_read, &tv) == -1)
sLog.outError("<Listen socket %u> Couldn't reschedule reading forcibly. Error [%u].",
pSocket->GetSocket(), errno);
}
else if(CONN_S == pSocket->GetType())
{
if(event_add(&pSocket->m_ev_read, NULL) == -1)
sLog.outError("<Socket %u> Couldn't reschedule reading by timeout. Error [%u].",
pSocket->GetSocket(), errno);
}
}
// else
// sLog.outError("DEBUG: \"no events were registered\" but EV_READ is pending");
}
m_Mutex.Unlock();
}