diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 17 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 39 |
2 files changed, 38 insertions, 18 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 4b8c0dffe..030007d1e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -317,6 +317,23 @@ void Server::AddSocket(InspSocket* sock) module_sockets.push_back(sock); } +void Server::RemoveSocket(InspSocket* sock) +{ + for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++) + { + InspSocket* s = (InspSocket*)*a; + if (s == sock) + { + log(DEBUG,"Forcibly removed socket"); + ServerInstance->SE->DelFd(s->GetFd()); + s->Close(); + module_sockets.erase(a); + delete s; + return; + } + } +} + void Server::RehashServer() { WriteOpers("*** Rehashing config file"); diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 0ecc595fc..35f63790b 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -203,7 +203,7 @@ class TreeServer { VersionString = ""; UserCount = OperCount = 0; - this->SetNextPingTime(time(NULL) + 300); + this->SetNextPingTime(time(NULL) + 120); this->SetPingFlag(); /* find the 'route' for this server (e.g. the one directly connected @@ -1977,7 +1977,7 @@ class TreeSocket : public InspSocket * When there is activity on the socket, reset the ping counter so * that we're not wasting bandwidth pinging an active server. */ - route_back_again->SetNextPingTime(time(NULL) + 300); + route_back_again->SetNextPingTime(time(NULL) + 120); route_back_again->SetPingFlag(); } @@ -2594,6 +2594,7 @@ class ModuleSpanningTree : public Module WriteOpers("*** SQUIT: Server \002%s\002 removed from network by %s",parameters[0],user->nick); sock->Squit(s,"Server quit by "+std::string(user->nick)+"!"+std::string(user->ident)+"@"+std::string(user->host)); sock->Close(); + Srv->RemoveSocket(sock); } else { @@ -2637,22 +2638,24 @@ class ModuleSpanningTree : public Module TreeSocket* sock = serv->GetSocket(); if (sock) { - if (curtime >= serv->NextPingTime()) - { - if (serv->AnsweredLastPing()) - { - sock->WriteLine(":"+Srv->GetServerName()+" PING "+serv->GetName()); - serv->SetNextPingTime(curtime + 300); - } - else - { - // they didnt answer, boot them - WriteOpers("*** Server \002%s\002 pinged out",serv->GetName().c_str()); - sock->Squit(serv,"Ping timeout"); - sock->Close(); - return; - } - } + if (curtime >= serv->NextPingTime()) + { + if (serv->AnsweredLastPing()) + { + sock->WriteLine(":"+Srv->GetServerName()+" PING "+serv->GetName()); + serv->SetNextPingTime(curtime + 120); + } + else + { + // they didnt answer, boot them + WriteOpers("*** Server \002%s\002 pinged out",serv->GetName().c_str()); + sock->Squit(serv,"Ping timeout"); + sock->Close(); + Srv->RemoveSocket(sock); + return; + } + } + } } } |