]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socketengines/socketengine_ports.cpp
Wheeeeee
[user/henk/code/inspircd.git] / src / socketengines / socketengine_ports.cpp
index 8e866b311b0f3602a5756cdd56e4fcd6ad496204..767ea0df0a8958f5235f7bfce00eb6ab53b7a4dd 100644 (file)
@@ -22,8 +22,8 @@ PortsEngine::PortsEngine(InspIRCd* Instance) : SocketEngine(Instance)
 
        if (EngineHandle == -1)
        {
-               ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno));
-               ServerInstance->Log(SPARSE,"ERROR: This is a fatal error, exiting now.");
+               ServerInstance->Logs->Log("SOCKET",SPARSE,"ERROR: Could not initialize socket engine: %s", strerror(errno));
+               ServerInstance->Logs->Log("SOCKET",SPARSE,"ERROR: This is a fatal error, exiting now.");
                printf("ERROR: Could not initialize socket engine: %s\n", strerror(errno));
                printf("ERROR: This is a fatal error, exiting now.\n");
                ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE);
@@ -51,7 +51,7 @@ bool PortsEngine::AddFd(EventHandler* eh)
        ref[fd] = eh;
        port_associate(EngineHandle, PORT_SOURCE_FD, fd, eh->Readable() ? POLLRDNORM : POLLWRNORM, eh);
 
-       ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
+       ServerInstance->Logs->Log("SOCKET",DEBUG,"New file descriptor: %d", fd);
        CurrentSetSize++;
        return true;
 }
@@ -72,7 +72,7 @@ bool PortsEngine::DelFd(EventHandler* eh, bool force)
        CurrentSetSize--;
        ref[fd] = NULL;
 
-       ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
+       ServerInstance->Logs->Log("SOCKET",DEBUG,"Remove file descriptor: %d", fd);
        return true;
 }
 
@@ -100,6 +100,8 @@ int PortsEngine::DispatchEvents()
        if (i == -1)
                return i;
 
+       TotalEvents += nget;
+
        for (i = 0; i < nget; i++)
        {
                switch (this->events[i].portev_source)
@@ -111,6 +113,10 @@ int PortsEngine::DispatchEvents()
                                {
                                        // reinsert port for next time around
                                        port_associate(EngineHandle, PORT_SOURCE_FD, fd, POLLRDNORM, ref[fd]);
+                                       if ((this->events[i].portev_events & POLLRDNORM))
+                                               ReadEvents++;
+                                       else
+                                               WriteEvents++;
                                        ref[fd]->HandleEvent((this->events[i].portev_events & POLLRDNORM) ? EVENT_READ : EVENT_WRITE);
                                }
                        }