diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-12 15:52:38 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-12 15:52:38 +0000 |
commit | a82a93f488ec67c3b6605b7fcbf65c65b37066f8 (patch) | |
tree | b49bd8bd41e406b951db010dc51362563e5824ed | |
parent | 1f2176d318d3ab64f507f3ae048d6fbb8a8e4a6d (diff) |
Added timeout fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2346 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/inspircd.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
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<InspSocket*>::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); |