summaryrefslogtreecommitdiff
path: root/src/commands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands.cpp')
-rw-r--r--src/commands.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 315caf9b9..f98ad5eb2 100644
--- a/src/commands.cpp
+++ b/src/commands.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>
@@ -68,6 +73,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;
@@ -960,8 +969,17 @@ void handle_quit(char **parameters, int pcnt, userrec *user)
/* push the socket on a stack of sockets due to be closed at the next opportunity */
if (user->fd > -1)
{
- shutdown(user->fd,2);
- close(user->fd);
+#ifdef USE_KQUEUE
+ struct kevent ke;
+ EV_SET(&ke, user->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(user->fd,2);
+ close(user->fd);
}
if (iter != clientlist.end())