summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-13 01:05:59 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-13 01:05:59 +0000
commita63ba66f5d1e8c4cee371bc94012272bed482e2c (patch)
tree236e6f86a81126cec25a608dbc0949929a684b6e
parent108dca35eafaa3ea4aad9ec21cbb723d7b3de587 (diff)
Fixed OnBackgroundTimer segfaults
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1064 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/inspircd.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index d19d42ff2..db198e601 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -3757,7 +3757,7 @@ int InspIRCd(void)
// we only read time() once per iteration rather than tons of times!
TIME = time(NULL);
- user_hash::iterator count2 = clientlist.begin();
+ //user_hash::iterator count2 = clientlist.begin();
// *FIX* Instead of closing sockets in kill_link when they receive the ERROR :blah line, we should queue
// them in a list, then reap the list every second or so.
@@ -3786,6 +3786,9 @@ int InspIRCd(void)
reap_counter=0;
}
reap_counter++;
+
+ // fix by brain - this must be below any manipulation of the hashmap by modules
+ user_hash::iterator count2 = clientlist.begin();
FD_ZERO(&serverfds);
@@ -3869,7 +3872,7 @@ int InspIRCd(void)
user_hash::iterator endingiter = count2;
if (count2 == clientlist.end()) break;
-
+
if (count2->second)
if (count2->second->fd != 0)
{
@@ -3883,7 +3886,7 @@ int InspIRCd(void)
if (count2 != clientlist.end())
{
// we don't check the state of remote users.
- if (count2->second->fd > 0)
+ if ((count2->second->fd != -1) && (count2->second->fd != FD_MAGIC_NUMBER))
{
FD_SET (count2->second->fd, &sfd);