From a82a93f488ec67c3b6605b7fcbf65c65b37066f8 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 12 Dec 2005 15:52:38 +0000 Subject: Added timeout fixes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2346 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 00c7c5f79..f75f59580 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2427,8 +2427,23 @@ void ProcessUser(userrec* cu) } } -void DoBackgroundUserStuff() +void DoBackgroundUserStuff(time_t TIME) { + unsigned int numsockets = module_sockets.size(); + for (std::vector::iterator a = module_sockets.begin(); a < module_sockets.end(); a++) + { + InspSocket* s = (InspSocket*)*a; + if (s->Timeout(TIME)) + { + log(DEBUG,"Socket poll returned false, close and bail"); + SE->DelFd(s->GetFd()); + s->Close(); + module_sockets.erase(a); + delete s; + break; + } + if (module_sockets.size() != numsockets) break; + } for (user_hash::iterator count2 = clientlist.begin(); count2 != clientlist.end(); count2++) { userrec* curr = NULL; @@ -2672,7 +2687,7 @@ int InspIRCd(char** argv, int argc) if ((TIME % 5) == 1) expire_run = false; - DoBackgroundUserStuff(); + DoBackgroundUserStuff(TIME); SE->Wait(activefds); -- cgit v1.3.1-10-gc9f91