summaryrefslogtreecommitdiffstats
path: root/cacheserver
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-03-24 18:24:42 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-03-24 18:24:42 +0800
commit9c4346e8ebea6e1e8086e30760f0d034862de151 (patch)
treef5ffcf8488297fa2dc980a9b31c3df02f610d005 /cacheserver
parentd552f049050a69f6fbb9593489797e941059a97a (diff)
downloadpttbbs-9c4346e8ebea6e1e8086e30760f0d034862de151.tar
pttbbs-9c4346e8ebea6e1e8086e30760f0d034862de151.tar.gz
pttbbs-9c4346e8ebea6e1e8086e30760f0d034862de151.tar.bz2
pttbbs-9c4346e8ebea6e1e8086e30760f0d034862de151.tar.lz
pttbbs-9c4346e8ebea6e1e8086e30760f0d034862de151.tar.xz
pttbbs-9c4346e8ebea6e1e8086e30760f0d034862de151.tar.zst
pttbbs-9c4346e8ebea6e1e8086e30760f0d034862de151.zip
* fix bug: utmpserver3 will add 'accept' event more than once into queue on heavy load,
then used up cpu resources. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3493 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'cacheserver')
-rw-r--r--cacheserver/utmpserver3.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cacheserver/utmpserver3.c b/cacheserver/utmpserver3.c
index 50dcfb57..e6bcb621 100644
--- a/cacheserver/utmpserver3.c
+++ b/cacheserver/utmpserver3.c
@@ -286,11 +286,6 @@ void connection_accept(int fd, short event, void *arg)
socklen_t len = sizeof(clientaddr);
int cfd;
- if (clients > MAX_CLIENTS) {
- event_del(&ev);
- return;
- }
-
if ((cfd = accept(fd, (struct sockaddr *)&clientaddr, &len)) < 0 )
return;
@@ -301,6 +296,10 @@ void connection_accept(int fd, short event, void *arg)
event_set(&cs->ev, cfd, EV_READ, (void *) connection_client, cs);
event_add(&cs->ev, &tv);
clients++;
+
+ if (clients >= MAX_CLIENTS) {
+ event_del(&ev);
+ }
}
int main(int argc, char *argv[])