]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/threadengines/threadengine_pthread.cpp
Move the definition of the BanCacheHit constructor into the source file from the...
[user/henk/code/inspircd.git] / src / threadengines / threadengine_pthread.cpp
index c1b964430a57b3493a65c2354fed8b25f7216725..8527907c491ca249dc40693e7e371ee5ac912e10 100644 (file)
@@ -75,11 +75,12 @@ class ThreadSignalSocket : public EventHandler
        ThreadSignalSocket(SocketThread* p, int newfd) : parent(p)
        {
                SetFd(newfd);
-               ServerInstance->SE->AddFd(this, FD_WANT_FAST_READ | FD_WANT_NO_WRITE);
+               SocketEngine::AddFd(this, FD_WANT_FAST_READ | FD_WANT_NO_WRITE);
        }
 
        ~ThreadSignalSocket()
        {
+               SocketEngine::Close(this);
        }
 
        void Notify()
@@ -104,6 +105,7 @@ class ThreadSignalSocket : public EventHandler
 
 SocketThread::SocketThread()
 {
+       signal.sock = NULL;
        int fd = eventfd(0, EFD_NONBLOCK);
        if (fd < 0)
                throw new CoreException("Could not create pipe " + std::string(strerror(errno)));
@@ -120,13 +122,14 @@ class ThreadSignalSocket : public EventHandler
                parent(p), send_fd(sendfd)
        {
                SetFd(recvfd);
-               ServerInstance->SE->NonBlocking(fd);
-               ServerInstance->SE->AddFd(this, FD_WANT_FAST_READ | FD_WANT_NO_WRITE);
+               SocketEngine::NonBlocking(fd);
+               SocketEngine::AddFd(this, FD_WANT_FAST_READ | FD_WANT_NO_WRITE);
        }
 
        ~ThreadSignalSocket()
        {
                close(send_fd);
+               SocketEngine::Close(this);
        }
 
        void Notify()
@@ -152,6 +155,7 @@ class ThreadSignalSocket : public EventHandler
 
 SocketThread::SocketThread()
 {
+       signal.sock = NULL;
        int fds[2];
        if (pipe(fds))
                throw new CoreException("Could not create pipe " + std::string(strerror(errno)));
@@ -166,4 +170,9 @@ void SocketThread::NotifyParent()
 
 SocketThread::~SocketThread()
 {
+       if (signal.sock)
+       {
+               signal.sock->cull();
+               delete signal.sock;
+       }
 }