summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-26 17:29:22 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-26 17:29:22 +0000
commitf3a1d7ea4bc13126996daf10031e89fd850c5945 (patch)
tree7b722843906ded7ce5d93338f0cdb45ce059f732 /src/inspircd.cpp
parent17b5f19bf1476cb22ccb409145600dac7209f823 (diff)
Added listening socket support for InspSocket
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1957 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index b9b9eb33e..0db94f5d4 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2340,11 +2340,15 @@ int InspIRCd(char** argv, int argc)
for (std::vector<InspSocket*>::iterator a = module_sockets.begin(); a < module_sockets.end(); a++)
{
InspSocket* s = (InspSocket*)*a;
- if (!s->Poll())
+ // Polling a listening socket class may result in the size of module_sockets increasing.
+ // This is still safe to do, however if the size of module_sockets is decreased, e.g.
+ // by a close or error, we cannot continue to use this iterator and must bail out asap.
+ if ((s) && (!s->Poll()))
{
+ log(DEBUG,"Socket poll returned false, close and bail");
s->Close();
- delete s;
module_sockets.erase(a);
+ delete s;
break;
}
}