1
0
mirror of https://github.com/anope/anope.git synced 2026-06-27 09:26:38 +02:00

Delete notify/client sockets when m_dns is unloaded

This commit is contained in:
Adam
2013-11-16 14:55:03 -05:00
parent c0b0ee1b39
commit 3ccf26fda4
+15 -3
View File
@@ -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);