Vanilla Development Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CVS update: Vanilla/ntserv
Date: Friday June 4, 1999 @ 0:55
Author: cameron
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory cvs.castle.real-time.com:/var/tmp/cvs-serv4759/ntserv
Modified Files:
socket.c
Log Message:
* ntserv/socket.c (doRead): logs show EINTR is happening on read(),
which implies that clients are being disconnected for no good reason,
changed to ignore EINTR and retry.
* ntserv/socket.c (socketPause): remove superfluous comments.
****************************************
Index: Vanilla/ntserv/socket.c
diff -u Vanilla/ntserv/socket.c:1.14 Vanilla/ntserv/socket.c:1.15
--- Vanilla/ntserv/socket.c:1.14 Thu Jun 3 05:09:48 1999
+++ Vanilla/ntserv/socket.c Fri Jun 4 00:55:51 1999
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.14 1999/06/03 10:09:48 cameron Exp $
+/* $Id: socket.c,v 1.15 1999/06/04 05:55:51 cameron Exp $
*/
/*
@@ -899,11 +899,6 @@
struct timeval timeout;
fd_set readfds;
-#ifdef PING
- /* this looks like an oversight here .. orig socketPause forgot to
- select on the udp socket as well */
-#endif
-
timeout.tv_sec=1;
timeout.tv_usec=0;
FD_ZERO(&readfds);
@@ -954,7 +949,6 @@
static int doRead(int asock)
{
struct timeval timeout;
-/* int readfds;*/
fd_set readfds;
char buf[BUFSIZ*2];
char *bufptr;
@@ -998,15 +992,17 @@
timeout.tv_sec=0;
timeout.tv_usec=0;
-/* readfds = 1<<asock;*/
FD_ZERO(&readfds);
FD_SET(asock, &readfds);
- /* Read info from the xtrek server */
- count=read(asock,buf,BUFSIZ*2);
+ while (1) {
+ count=read(asock,buf,BUFSIZ*2);
+ if (count > 0) break;
+ if (errno != EINTR) break;
+ if (count == 0) errno = 0; /* save reporting bogus errno */
+ }
if (count<=0) {
- /* (this happens when the client hits 'Q') */
- ERROR(9,("%s: read() failed, %s\n",
- whoami(), strerror(errno)));
+ /* (this also happens when the client hits 'Q') */
+ ERROR(9,("%s: read() failed, %s\n", whoami(), strerror(errno)));
if (asock == udpSock) {
if (errno == ECONNREFUSED) {
struct sockaddr_in addr;
@@ -1024,7 +1020,7 @@
UDPDIAG(("Reconnect successful\n"));
return (0);
}
- }
+ } /* errno == ECONNREFUSED */
UDPDIAG(("*** UDP disconnected (res=%d, err=%d)\n",
count, errno));
@@ -1034,7 +1030,7 @@
#ifdef notdef
return(0); /* I have large questions here -- tell client? */
#endif
- }
+ } /* asock == udpSock */
clientDead=1;
return(0);
}