X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fthreadengines%2Fthreadengine_pthread.cpp;h=40205da3118533479382f8f7f8dba2b5e182ffe1;hb=748b3a0d89e7ecc9a766471b79fb78f63a5ca2bb;hp=c1b964430a57b3493a65c2354fed8b25f7216725;hpb=fcacc8e0306382bc3f938073092c3729d77e2b41;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/threadengines/threadengine_pthread.cpp b/src/threadengines/threadengine_pthread.cpp index c1b964430..40205da31 100644 --- a/src/threadengines/threadengine_pthread.cpp +++ b/src/threadengines/threadengine_pthread.cpp @@ -80,6 +80,8 @@ class ThreadSignalSocket : public EventHandler ~ThreadSignalSocket() { + ServerInstance->SE->DelFd(this); + ServerInstance->SE->Close(GetFd()); } void Notify() @@ -104,9 +106,10 @@ 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))); + throw CoreException("Could not create pipe " + std::string(strerror(errno))); signal.sock = new ThreadSignalSocket(this, fd); } #else @@ -127,6 +130,8 @@ class ThreadSignalSocket : public EventHandler ~ThreadSignalSocket() { close(send_fd); + ServerInstance->SE->DelFd(this); + ServerInstance->SE->Close(GetFd()); } void Notify() @@ -152,9 +157,10 @@ 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))); + throw CoreException("Could not create pipe " + std::string(strerror(errno))); signal.sock = new ThreadSignalSocket(this, fds[0], fds[1]); } #endif @@ -166,4 +172,9 @@ void SocketThread::NotifyParent() SocketThread::~SocketThread() { + if (signal.sock) + { + signal.sock->cull(); + delete signal.sock; + } }