#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;
SocketEngine::SocketEngine(InspIRCd* Instance) : ServerInstance(Instance)
{
TotalEvents = WriteEvents = ReadEvents = ErrorEvents = 0;
- lastempty = time(NULL);
+ lastempty = ServerInstance->Time();
indata = outdata = 0;
}
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;