summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-10 16:18:50 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-10 16:18:50 +0000
commit2d5b44e4275571e8d56bb503124b6752f090629d (patch)
treea52544c793b33c4d07691d4af2fb9cb89bf19b12 /src/inspircd.cpp
parent26f8439040f8a49d4883dcd59709172360a1fbc8 (diff)
Added ability to accept() up to 32 pending sockets at once
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1356 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 1f7487242..835952a14 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -4173,6 +4173,7 @@ int InspIRCd(char** argv, int argc)
#ifdef USE_KQUEUE
struct kevent ke;
+ struct kevent ke_list[33];
struct timespec ts;
#endif
fd_set serverfds;
@@ -4187,7 +4188,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;
+ int i = 0, v = 0, j = 0;
bool expire_run = false;
/* main loop, this never returns */
@@ -4658,8 +4659,8 @@ int InspIRCd(char** argv, int argc)
#else
ts.tv_sec = 0;
ts.tv_nsec = 30000L;
- i = kevent(lkq, NULL, 0, &ke, 1, &ts);
- if (i > 0)
+ i = kevent(lkq, NULL, 0, ke_list, 32, &ts);
+ if (i > 0) for (j = 0; j < i; j++)
{
log(DEBUG,"kqueue: Listening socket event, i=%d, ke.ident=%d",i,ke.ident);
// this isnt as efficient as it could be, we could create a reference table
@@ -4668,7 +4669,7 @@ int InspIRCd(char** argv, int argc)
// compared to the number of clients (possibly over 2000)
for (count = 0; count < boundPortCount; count++)
{
- if (ke.ident == openSockfd[count])
+ if (ke_list[j].ident == openSockfd[count])
{
#endif
char target[MAXBUF], resolved[MAXBUF];
@@ -4691,7 +4692,7 @@ int InspIRCd(char** argv, int argc)
AddClient(incomingSockfd, resolved, ports[count], false, inet_ntoa (client.sin_addr));
log(DEBUG,"InspIRCd: adding client on port %lu fd=%lu",(unsigned long)ports[count],(unsigned long)incomingSockfd);
}
- goto label;
+ //goto label;
}
}
}