diff options
author | jwise <jwise@pkgsrc.org> | 2006-05-11 03:55:04 +0000 |
---|---|---|
committer | jwise <jwise@pkgsrc.org> | 2006-05-11 03:55:04 +0000 |
commit | 2245676c5176220479d714559e146f97329dc167 (patch) | |
tree | be7b1c48b5cc4d9f5c8ebb57c3eb1820e44534c4 /chat | |
parent | d4d4b48275bab3bb168ef72649545baffe8e61e9 (diff) | |
download | pkgsrc-2245676c5176220479d714559e146f97329dc167.tar.gz |
Update to i2cbd-2.0_BETA5: fold in patch-aj, from Thor Lancelot Simon:
Don't set O_NDELAY (and leave it set!) on all sockets, all the time. This
was making select always return immediately and was causing the daemon to
spin on CPU.
Instead, set O_NONBLOCK (= O_NDELAY) on sockets only when reading/writing
them, and clear it afterwards, so select is always safe.
Diffstat (limited to 'chat')
-rw-r--r-- | chat/i2cbd/Makefile | 4 | ||||
-rw-r--r-- | chat/i2cbd/distinfo | 9 | ||||
-rw-r--r-- | chat/i2cbd/patches/patch-aj | 154 |
3 files changed, 6 insertions, 161 deletions
diff --git a/chat/i2cbd/Makefile b/chat/i2cbd/Makefile index 8de5f97ffb2..448b81d9b27 100644 --- a/chat/i2cbd/Makefile +++ b/chat/i2cbd/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.21 2006/05/11 02:36:15 jwise Exp $ +# $NetBSD: Makefile,v 1.22 2006/05/11 03:55:04 jwise Exp $ # -DISTNAME= i2cbd-2.0_BETA4 +DISTNAME= i2cbd-2.0_BETA5 CATEGORIES= chat MASTER_SITES= ${MASTER_SITE_LOCAL} \ http://www.draga.com/~jwise/i2cb/ diff --git a/chat/i2cbd/distinfo b/chat/i2cbd/distinfo index 3a67d0cc7d0..036947d9131 100644 --- a/chat/i2cbd/distinfo +++ b/chat/i2cbd/distinfo @@ -1,9 +1,8 @@ -$NetBSD: distinfo,v 1.13 2006/05/11 03:20:29 tls Exp $ +$NetBSD: distinfo,v 1.14 2006/05/11 03:55:04 jwise Exp $ -SHA1 (i2cbd-2.0_BETA4.tar.gz) = 6a0e55344a59461795f39f9bba08b0c47f5e4187 -RMD160 (i2cbd-2.0_BETA4.tar.gz) = 0fef06c70d6fcec53235fd2d7385c0bb780cad3b -Size (i2cbd-2.0_BETA4.tar.gz) = 58969 bytes +SHA1 (i2cbd-2.0_BETA5.tar.gz) = be219c5b6fa2413681214d756dee02c3cd252843 +RMD160 (i2cbd-2.0_BETA5.tar.gz) = d48988fb175857370c2523c86e0e586decbe28ae +Size (i2cbd-2.0_BETA5.tar.gz) = 59158 bytes SHA1 (patch-aa) = 0151f8e68be11e759425d2e9569df3d465c50931 SHA1 (patch-ab) = bca8ecb0f41be6405333f2bcf7722dc725ffc777 SHA1 (patch-ac) = ca8e6b7324a22fb9ecabf2374e34febb55196e28 -SHA1 (patch-aj) = 5290cb02aa15f263d3578b264d7cba3d21650d7d diff --git a/chat/i2cbd/patches/patch-aj b/chat/i2cbd/patches/patch-aj deleted file mode 100644 index 52757ececb0..00000000000 --- a/chat/i2cbd/patches/patch-aj +++ /dev/null @@ -1,154 +0,0 @@ ---- src/makeport.c.orig 2001-10-26 20:03:37.000000000 +0000 -+++ src/makeport.c 2006-05-11 01:46:34.000000000 +0000 -@@ -64,12 +64,6 @@ - /* start listening for connections */ - listen(s, 5); - -- /* make it non-blocking */ -- if (fcntl(s, F_SETFL, FNDELAY) < 0) { -- perror("makenewport: fcntl"); -- return(-1); -- } -- - /* Don't close on exec */ - flags = fcntl(s, F_GETFD, 0); - flags = flags & ~ FD_CLOEXEC; ---- src/newconnect.c.orig 2006-04-30 23:28:07.000000000 +0000 -+++ src/newconnect.c 2006-05-11 01:46:56.000000000 +0000 -@@ -65,12 +65,6 @@ - perror("SO_SNDBUF"); - } - -- /* make the socket non-blocking */ -- if (fcntl(ns, F_SETFL, FNDELAY) < 0) { -- perror("new_client:fcntl"); -- return(-1); -- } -- - /* Don't close on exec */ - flags = fcntl(ns, F_GETFD, 0); - flags = flags & ~ FD_CLOEXEC; ---- src/sendpacket.c.orig 2000-03-23 14:41:52.000000000 +0000 -+++ src/sendpacket.c 2006-05-11 01:03:30.000000000 +0000 -@@ -7,6 +7,7 @@ - #include <sys/socket.h> - #include <stdio.h> - #include <errno.h> -+#include <fcntl.h> - #include "externs.h" - - int sendpacket(int, char *); -@@ -14,23 +15,37 @@ - int - sendpacket(int s, char *pkt) - { -- int ret; -+ int sent, ret = 1, fcarg; - int totlength; - - /* set up a sample packet for testing purposes */ - totlength = (unsigned char)*pkt + 1; - -- if ((ret = send(s, pkt, totlength, 0)) < 0) { -+ /* make the socket non-blocking */ -+ if (((fcarg = fcntl(s, F_GETFL, 0)) < 0 || -+ fcntl(s, F_SETFL, fcarg | O_NONBLOCK) < 0)) { -+ perror("sendpacket:fcntl"); -+ return(-1); -+ } -+ -+ if ((sent = send(s, pkt, totlength, 0)) < 0) { - if (errno == EWOULDBLOCK) -- return(0); -+ ret = 0; - else if (errno == EPIPE) -- return(-2); -+ ret = -1; - else { - /* DEBUG temorary fix */ -- return(-2); -+ ret = -2; - } -+ } else { -+ if(sent != totlength) -+ ret = -1; -+ } -+ -+ if (fcntl(s, F_SETFL, fcarg & ~O_NONBLOCK) < 0) { -+ perror("sendpacket:fcntl"); -+ ret = -1; - } -- if (ret != totlength) -- return(-1); -- return(1); -+ -+ return(ret); - } ---- src/serverserve.c.orig 2006-05-11 01:42:08.000000000 +0000 -+++ src/serverserve.c 2006-05-11 01:30:24.000000000 +0000 -@@ -5,6 +5,7 @@ - /* active clients, new connections, and perform asynch dungeon action */ - - #include <errno.h> -+#include <fcntl.h> - #include <signal.h> - #include <stdio.h> - #include <stdlib.h> -@@ -103,8 +104,7 @@ - static void - sdoinput(void) - { -- int n; -- register int x; -+ int n, x, fcarg; - - for (x = 1; x <= highestfd; x++) - if (FD_ISSET(x, &efdr) > 0) { -@@ -112,7 +112,9 @@ - } - - /* examine set of file descriptors */ -- for (x = 1; x <= highestfd; x++) -+ for (x = 1; x <= highestfd; x++) { -+ int closed = 0; -+ - if (FD_ISSET(x, &fdr) > 0) { - if (FD_ISSET(x,&serversocks)) { - /* new connect on advertised socket */ -@@ -121,6 +123,16 @@ - s_new_user(n); - } else { - /* fd is client input */ -+ -+ /* make the socket non-blocking */ -+ if (((fcarg = fcntl(x, F_GETFL, 0)) < 0 || -+ fcntl(x, F_SETFL, fcarg | O_NONBLOCK) -+ < 0)) { -+ perror("sdoinput:fcntl"); -+ disconnectuser(x); -+ continue; -+ } -+ - switch(readpacket(x, &cbufs[x])) - { - case 1: -@@ -136,8 +148,19 @@ - case -2: - /* close connection */ - disconnectuser(x); -+ closed = 1; - break; - } -+ -+ if (!closed) { -+ if(fcntl(x, F_SETFL, -+ fcarg & ~O_NONBLOCK) < 0) { -+ perror("sdoinput: fcntl"); -+ disconnectuser(x); -+ } -+ } -+ - } - } -+ } - } |