X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocketengine.cpp;h=43de35e1ea7e3e9eb8f8cfb351e38f2ba6bb19b2;hb=4e1ae0981e1d6b306d316b2f66a2fc72a36e0e87;hp=51140ee023f14ac4ff286cc7ed5c7f93448cd355;hpb=742d519b6766ca39fab713016a09ee39b27a7527;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 51140ee02..43de35e1e 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team + * InspIRCd: (C) 2002-2009 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -11,12 +11,18 @@ * --------------------------------------------------- */ -/* $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 */ @@ -35,6 +41,34 @@ #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; @@ -62,7 +96,7 @@ void SocketEngine::WantWrite(EventHandler* eh) SocketEngine::SocketEngine(InspIRCd* Instance) : ServerInstance(Instance) { TotalEvents = WriteEvents = ReadEvents = ErrorEvents = 0; - lastempty = time(NULL); + lastempty = ServerInstance->Time(); indata = outdata = 0; } @@ -229,9 +263,9 @@ void SocketEngine::RecoverFromFork() void SocketEngine::UpdateStats(size_t len_in, size_t len_out) { - if (lastempty + 1 > time(NULL)) + if (lastempty != ServerInstance->Time()) { - lastempty = time(NULL); + lastempty = ServerInstance->Time(); indata = outdata = 0; } indata += len_in;