* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- * E-mail:
- * <brain@chatspike.net>
- * <Craig@chatspike.net>
+ * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
*
- * Written by Craig Edwards, Craig McLure, and others.
* This program is free but copyrighted software; see
* the file COPYING for details.
*
int fd = eh->GetFd();
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
{
- ServerInstance->Log(DEFAULT,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
+ ServerInstance->Log(DEBUG,"ERROR: FD of %d added above max of %d",fd,MAX_DESCRIPTORS);
return false;
}
if (GetRemainingFds() <= 1)
{
- ServerInstance->Log(DEFAULT,"ERROR: System out of file descriptors!");
+ ServerInstance->Log(DEBUG,"ERROR: System out of file descriptors!");
return false;
}
{
int fd = eh->GetFd();
- ServerInstance->Log(DEBUG,"SelectEngine::DelFd(%d)",fd);
-
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
return false;
std::map<int,int>::iterator t = fds.find(fd);
if (t != fds.end())
- {
fds.erase(t);
- ServerInstance->Log(DEBUG,"Deleted fd %d",fd);
- }
CurrentSetSize--;
ref[fd] = NULL;
FD_SET (a->second, &errfdset);
}
- tval.tv_sec = 0;
- tval.tv_usec = 50L;
+ tval.tv_sec = 1;
+ tval.tv_usec = 0;
sresult = select(FD_SETSIZE, &rfdset, &wfdset, &errfdset, &tval);
if (sresult > 0)
{
{
if (getsockopt(ev[i]->GetFd(), SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0)
errcode = errno;
+
ev[i]->HandleEvent(EVENT_ERROR, errcode);
}
continue;
}
- ServerInstance->Log(DEBUG,"Handle %s event on fd %d",writeable[ev[i]->GetFd()] || !ev[i]->Readable() ? "write" : "read", ev[i]->GetFd());
- if (writeable[ev[i]->GetFd()])
- {
- if (ev[i])
- ev[i]->HandleEvent(EVENT_WRITE);
- writeable[ev[i]->GetFd()] = false;
-
- }
- else
+ if (ev[i])
{
- if (ev[i])
- ev[i]->HandleEvent(ev[i]->Readable() ? EVENT_READ : EVENT_WRITE);
+ if (writeable[ev[i]->GetFd()])
+ {
+ if (ev[i])
+ ev[i]->HandleEvent(EVENT_WRITE);
+ writeable[ev[i]->GetFd()] = false;
+
+ }
+ else
+ {
+ if (ev[i])
+ ev[i]->HandleEvent(ev[i]->Readable() ? EVENT_READ : EVENT_WRITE);
+ }
}
}
}