summaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-09 20:56:44 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-09 20:56:44 +0000
commit8399a0bede79afd8f8a7cb23a4ded974584d437a (patch)
treee6251fa20dcbf07046730bb92e26142ca5abf811 /src/modules.cpp
parent5f5d2c12315effeeee24637266a25a814b9fdd73 (diff)
Basics of kqueue() implementation for socket engine
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1348 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index 006802cf5..e29299d5e 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -23,6 +23,11 @@
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
+#ifdef USE_KQUEUE
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/time.h>
+#endif
#include <cstdio>
#include <time.h>
#include <string>
@@ -61,6 +66,10 @@
using namespace std;
+#ifdef USE_KQUEUE
+extern int kq;
+#endif
+
extern int MODCOUNT;
extern std::vector<Module*> modules;
extern std::vector<ircd_module*> factory;
@@ -674,8 +683,17 @@ bool Server::UserToPseudo(userrec* user,std::string message)
user->fd = FD_MAGIC_NUMBER;
user->ClearBuffer();
Write(old_fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
- shutdown(old_fd,2);
- close(old_fd);
+#ifdef USE_KQUEUE
+ struct kevent ke;
+ EV_SET(&ke, old_fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
+ int i = kevent(kq, &ke, 1, 0, 0, NULL);
+ if (i == -1)
+ {
+ log(DEBUG,"kqueue: Failed to remove user from queue!");
+ }
+#endif
+ shutdown(old_fd,2);
+ close(old_fd);
}
bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message)