X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsocketengines%2Fsocketengine_kqueue.cpp;h=a2bbd5afe442e18445056abec795019f648a454a;hb=ab4dee91de96555db158db91240ff91520318068;hp=18a2261eff7a0f14370b0850e925061660b79eea;hpb=cbb8fda4a7e763738e9675ec9f96286c87879176;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/socketengines/socketengine_kqueue.cpp b/src/socketengines/socketengine_kqueue.cpp index 18a2261ef..a2bbd5afe 100644 --- a/src/socketengines/socketengine_kqueue.cpp +++ b/src/socketengines/socketengine_kqueue.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -34,10 +34,10 @@ void KQueueEngine::RecoverFromFork() EngineHandle = kqueue(); if (EngineHandle == -1) { - ServerInstance->Log(SPARSE,"ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); - ServerInstance->Log(SPARSE,"ERROR: this is a fatal error, exiting now."); - printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); - printf("ERROR: this is a fatal error, exiting now."); + ServerInstance->Log(DEFAULT, "ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features."); + ServerInstance->Log(DEFAULT, "ERROR: this is a fatal error, exiting now."); + printf("ERROR: Could not initialize socket engine. Your kernel probably does not have the proper features.\n"); + printf("ERROR: this is a fatal error, exiting now.\n"); ServerInstance->Exit(EXIT_STATUS_SOCKETENGINE); } CurrentSetSize = 0; @@ -128,7 +128,11 @@ int KQueueEngine::DispatchEvents() { ts.tv_nsec = 0; ts.tv_sec = 1; + int i = kevent(EngineHandle, NULL, 0, &ke_list[0], MAX_DESCRIPTORS, &ts); + + TotalEvents += i; + for (int j = 0; j < i; j++) { if (ke_list[j].flags & EV_EOF) @@ -138,6 +142,7 @@ int KQueueEngine::DispatchEvents() * Unlike smelly epoll and select, where we have to getsockopt * to get the error, this saves us time and cpu cycles. Go BSD! */ + ErrorEvents++; if (ref[ke_list[j].ident]) ref[ke_list[j].ident]->HandleEvent(EVENT_ERROR, ke_list[j].fflags); continue; @@ -150,11 +155,13 @@ int KQueueEngine::DispatchEvents() struct kevent ke; EV_SET(&ke, ke_list[j].ident, EVFILT_READ, EV_ADD, 0, 0, NULL); kevent(EngineHandle, &ke, 1, 0, 0, NULL); + WriteEvents++; if (ref[ke_list[j].ident]) ref[ke_list[j].ident]->HandleEvent(EVENT_WRITE); } else { + ReadEvents++; if (ref[ke_list[j].ident]) ref[ke_list[j].ident]->HandleEvent(EVENT_READ); }