X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocketengine.cpp;h=187a06541f53f30a6b7a8be8763216d695408914;hb=a64a4665e0a2898ec08cf5996bdbf63c2567310e;hp=74f8c18617a464b667430ba3fa46513d12d283a8;hpb=61fed23a3e9a62f19c2f88208585b31356c986ef;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socketengine.cpp b/src/socketengine.cpp index 74f8c1861..187a06541 100644 --- a/src/socketengine.cpp +++ b/src/socketengine.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -41,20 +41,27 @@ #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 + return false; - this->IOHook = false; + this->IOHook = NULL; + return true; } Module *EventHandler::GetIOHook() @@ -89,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; } @@ -142,7 +149,7 @@ std::string SocketEngine::GetName() } bool SocketEngine::BoundsCheckFd(EventHandler* eh) -{ +{ if (!eh) return false; if ((eh->GetFd() < 0) || (eh->GetFd() > MAX_DESCRIPTORS)) @@ -256,9 +263,9 @@ void SocketEngine::RecoverFromFork() void SocketEngine::UpdateStats(size_t len_in, size_t len_out) { - if (lastempty != time(NULL)) + if (lastempty != ServerInstance->Time()) { - lastempty = time(NULL); + lastempty = ServerInstance->Time(); indata = outdata = 0; } indata += len_in;