* ---------------------------------------------------
*/
-/* $Core: libIRCDsocketengine */
+/* $Core */
/********* DEFAULTS **********/
+
/* $ExtraSources: socketengines/socketengine_select.cpp */
/* $ExtraObjects: socketengine_select.o */
+/* $If: USE_POLL */
+/* $ExtraSources: socketengines/socketengine_poll.cpp */
+/* $ExtraObjects: socketengine_poll.o */
+/* $EndIf */
+
/* $If: USE_KQUEUE */
/* $ExtraSources: socketengines/socketengine_kqueue.cpp */
/* $ExtraObjects: socketengine_kqueue.o */
#include "inspircd.h"
#include "socketengine.h"
+EventHandler::EventHandler()
+{
+ this->IOHook = NULL;
+}
+
+bool EventHandler::AddIOHook(Module *IOHooker)
+{
+ if (this->IOHook)
+ return false;
+
+ this->IOHook = IOHooker;
+ return true;
+}
+
+bool EventHandler::DelIOHook()
+{
+ if (!this->IOHook)
+ return false;
+
+ this->IOHook = NULL;
+ return true;
+}
+
+Module *EventHandler::GetIOHook()
+{
+ return this->IOHook;
+}
+
int EventHandler::GetFd()
{
return this->fd;
void SocketEngine::UpdateStats(size_t len_in, size_t len_out)
{
- if (lastempty + 1 > time(NULL))
+ if (lastempty != time(NULL))
{
lastempty = time(NULL);
indata = outdata = 0;