Vanilla Development Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS update: Vanilla/ntserv
Date: Tuesday February 22, 19100 @ 20:48
Author: xyzzy
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv30462
Modified Files:
socket.c
Log Message:
Clean up select() calls. There is no reason that the sockets will have
descriptors less than 31. Also, 0 is not a pointer, NULL is a pointer.
****************************************
Index: Vanilla/ntserv/socket.c
diff -u Vanilla/ntserv/socket.c:1.18 Vanilla/ntserv/socket.c:1.19
--- Vanilla/ntserv/socket.c:1.18 Tue Feb 22 20:39:09 2000
+++ Vanilla/ntserv/socket.c Tue Feb 22 20:48:12 2000
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.18 2000/02/23 02:39:09 xyzzy Exp $
+/* $Id: socket.c,v 1.19 2000/02/23 02:48:12 xyzzy Exp $
*/
/*
@@ -425,7 +425,7 @@
timeout.tv_usec=0;
FD_ZERO(&writefds);
FD_SET(ns, &writefds);
- stat = select(32,0,&writefds,0,&timeout);
+ stat = select(ns+1, NULL, &writefds, NULL, &timeout);
if (stat < 0) {
ERROR(1,("%s: select() after connect() failed, %s\n", whoami(),
strerror(errno)));
@@ -909,7 +909,7 @@
if (udpSock >= 0)
FD_SET(udpSock, &readfds);
- select(32,&readfds,0,0,&timeout);
+ select(MAX(sock, udpSock)+1, &readfds, NULL, NULL, &timeout);
}
/* Find out if client has any requests */
@@ -926,7 +926,7 @@
FD_SET(sock, &readfds);
if (udpSock >= 0)
FD_SET(udpSock, &readfds);
- if (select(32,&readfds,0,0,&timeout) != 0) {
+ if (select(MAX(sock, udpSock)+1, &readfds, NULL, NULL, &timeout) != 0) {
/* Read info from the xtrek client */
if (FD_ISSET(sock, &readfds)) {
retval += doRead(sock);
@@ -1072,7 +1072,7 @@
/*readfds=1<<asock;*/
FD_ZERO(&readfds);
FD_SET(asock, &readfds);
- if (select(32,&readfds,0,0,&timeout) == 0) {
+ if (select(asock+1, &readfds, NULL, NULL, &timeout) == 0) {
logmessage("Died while waiting for packet...");
ERROR(1,( "1a) read() failed (%d, error %d)\n",
count, errno));
@@ -1145,7 +1145,7 @@
/*readfds = 1<<asock;*/
FD_ZERO(&readfds);
FD_SET(asock, &readfds);
- if (select(32,&readfds,0,0,&timeout)) {
+ if (select(asock+1, &readfds, NULL, NULL, &timeout)) {
temp=read(asock,buf+BUFSIZ,BUFSIZ);
count=BUFSIZ+temp;
if (temp<=0) {