diff options
author | Adam <Adam@anope.org> | 2013-11-16 14:55:03 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-11-16 14:55:03 -0500 |
commit | 3ccf26fda4ff70e8fe62dc47006ce8fbd10eb6f1 (patch) | |
tree | a89428f6f84c0b06186406e9e72ba71b3b69953e | |
parent | c0b0ee1b39f99a66c5f76d89299111d5520ea25c (diff) |
Delete notify/client sockets when m_dns is unloaded
-rw-r--r-- | modules/m_dns.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/modules/m_dns.cpp b/modules/m_dns.cpp index 1637ccd98..6e67cfe60 100644 --- a/modules/m_dns.cpp +++ b/modules/m_dns.cpp @@ -460,6 +460,9 @@ namespace DNS /* Listens for TCP requests */ class TCPSocket : public ListenSocket { + Manager *manager; + + public: /* A TCP client */ class Client : public ClientSocket, public Timer, public ReplySocket { @@ -539,9 +542,6 @@ class TCPSocket : public ListenSocket } }; - Manager *manager; - - public: TCPSocket(Manager *m, const Anope::string &ip, int port) : Socket(-1, ip.find(':') != Anope::string::npos), ListenSocket(ip, port, ip.find(':') != Anope::string::npos), manager(m) { } ClientSocket *OnAccept(int fd, const sockaddrs &addr) anope_override @@ -1019,6 +1019,18 @@ class ModuleDNS : public Module } + ~ModuleDNS() + { + for (std::map<int, Socket *>::const_iterator it = SocketEngine::Sockets.begin(), it_end = SocketEngine::Sockets.end(); it != it_end;) + { + Socket *s = it->second; + ++it; + + if (dynamic_cast<NotifySocket *>(s) || dynamic_cast<TCPSocket::Client *>(s)) + delete s; + } + } + void OnReload(Configuration::Conf *conf) anope_override { Configuration::Block *block = conf->GetModule(this); |