summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-10 23:44:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-10 23:44:51 +0000
commita194fcaed59490840b3b6aa54e8367a003913ca5 (patch)
tree91ad71556bdaa7151d75a1b57a6c7770ad60fd9b
parentfc084d5ffa982eaf0143c4350b66e3f61ae110e5 (diff)
Made ping check loop less regular in kqueue version
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1358 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/inspircd.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 835952a14..41aaa4356 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -109,7 +109,7 @@ int openSockfd[MAXSOCKS];
bool nofork = false;
bool unlimitcore = false;
-time_t TIME = time(NULL);
+time_t TIME = time(NULL), OLDTIME = time(NULL);
#ifdef USE_KQUEUE
int kq, lkq, skq;
@@ -4069,7 +4069,9 @@ int InspIRCd(char** argv, int argc)
WritePID(PID);
/* setup select call */
+#ifndef USE_KQUEUE
FD_ZERO(&selectFds);
+#endif
log(DEBUG,"InspIRCd: startup: zero selects");
log(VERBOSE,"InspIRCd: startup: portCount = %lu", (unsigned long)portCount);
@@ -4188,7 +4190,7 @@ int InspIRCd(char** argv, int argc)
tval.tv_usec = 10000L;
tval.tv_sec = 0;
int total_in_this_set = 0;
- int i = 0, v = 0, j = 0;
+ int i = 0, v = 0, j = 0, cycle_iter = 0;
bool expire_run = false;
/* main loop, this never returns */
@@ -4197,13 +4199,18 @@ int InspIRCd(char** argv, int argc)
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield();
#endif
- // poll dns queue
- dns_poll();
+#ifndef USE_KQUEUE
FD_ZERO(&sfd);
+#endif
// we only read time() once per iteration rather than tons of times!
+ OLDTIME = TIME;
TIME = time(NULL);
+ // poll dns queue
+ if (TIME != OLDTIME)
+ dns_poll();
+
// *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.
if (((TIME % 5) == 0) && (!expire_run))
@@ -4305,7 +4312,9 @@ int InspIRCd(char** argv, int argc)
while (count2 != clientlist.end())
{
+#ifndef USE_KQUEUE
FD_ZERO(&sfd);
+#endif
total_in_this_set = 0;
@@ -4384,11 +4393,12 @@ int InspIRCd(char** argv, int argc)
endingiter = count2;
count2 = xcount; // roll back to where we were
#else
- dns_poll();
// KQUEUE: We don't go through a loop to fill the fd_set so instead we must manually do this loop every now and again.
// TODO: We dont need to do all this EVERY loop iteration, tone down the visits to this if we're using kqueue.
- while (count2 != clientlist.end())
+ cycle_iter++;
+ if (cycle_iter > 10) while (count2 != clientlist.end())
{
+ cycle_iter = 0;
if (count2 != clientlist.end())
{
curr = count2->second;