From a63ba66f5d1e8c4cee371bc94012272bed482e2c Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 13 Apr 2005 01:05:59 +0000 Subject: Fixed OnBackgroundTimer segfaults git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1064 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') 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); -- cgit v1.2.3