Vanilla Development Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS update: Vanilla/ntserv



Date:	Friday May 28, 1999 @ 3:40
Author:	cameron

Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory cvs.castle.real-time.com:/var/tmp/cvs-serv3494

Modified Files:
	getentry.c input.c main.c ntscmds.c socket.c solicit.c 
	sysdefaults.c 
Added Files:
	solicit.h 
Log Message:
immaterial logging changes for diagnosing continuum faults

****************************************

Index: Vanilla/ntserv/getentry.c
diff -u Vanilla/ntserv/getentry.c:1.4 Vanilla/ntserv/getentry.c:1.5
--- Vanilla/ntserv/getentry.c:1.4	Fri Apr 30 15:18:43 1999
+++ Vanilla/ntserv/getentry.c	Fri May 28 03:40:42 1999
@@ -40,8 +40,8 @@
 	flushSockBuf();		
 	/* Have we been busted? */
 	if (me->p_status == PFREE) {
-            ERROR(1,("getentry: unfreeing a PFREE (pid %i)\n",
-                     (int) getpid()));
+            ERROR(1,("%s: getentry() unfreeing a PFREE (pid %i)\n",
+		     me->p_mapchars, (int) getpid()));
 	    me->p_status=PDEAD;
 	    me->p_explode=600;
 	}
@@ -51,10 +51,8 @@
 	    int i;
 
 	    if (noressurect) exitGame();
-      	    ERROR(2,("getentry: The client went away! (%s@%s)\n",
-        		me->p_login,
-        		me->p_monitor));
-	    ERROR(2,("getentry: I will attempt to resurrect him!\n"));
+      	    ERROR(2,("%s: getentry() commences resurrection\n",
+        		me->p_mapchars));
 
 	    /* UDP fail-safe */
 	    commMode = COMM_TCP;
@@ -67,7 +65,8 @@
 	    for (i=0;; i++) {
 		switch(me->p_status) {
 		case PFREE:
-                    ERROR(1,("getentry: unfreeing a PFREE"));
+                    ERROR(1,("%s: getentry() unfreeing a PFREE", 
+			     me->p_mapchars));
 		    me->p_status=PDEAD;
 		    me->p_explode=600;
 		    break;
@@ -89,7 +88,7 @@
 		sleep(5);
 		if (connectToClient(host, nextSocket)) break;
 		if (i>=11) {
-		    ERROR(2,("getentry: Oh well, maybe I'm getting rusty!\n"));
+		    ERROR(2,("%s: getentry() giving up\n", me->p_mapchars)); 
 		    switch(me->p_status) {
 		    case PFREE:
 			break;
@@ -111,11 +110,12 @@
 		    exitGame();
 		}
 	    }
-	    ERROR(2,("A miracle!  He's alive!\n"));
+	    ERROR(2,("%s: getentry() resurrected\n", me->p_mapchars));
 
             if(me->p_process != getpid()){
                 /* whoops, co-pilot.  We're outa here */
-	        ERROR(1,("getentry: exiting a co-pilot\n"));
+	        ERROR(1,("%s: getentry() exiting a co-pilot\n",
+			 me->p_mapchars));
                 (void) forceShutdown(-10);
             }
 
Index: Vanilla/ntserv/input.c
diff -u Vanilla/ntserv/input.c:1.5 Vanilla/ntserv/input.c:1.6
--- Vanilla/ntserv/input.c:1.5	Fri Apr 30 15:18:44 1999
+++ Vanilla/ntserv/input.c	Fri May 28 03:40:42 1999
@@ -1,4 +1,4 @@
-/* $Id: input.c,v 1.5 1999/04/30 20:18:44 ahn Exp $
+/* $Id: input.c,v 1.6 1999/05/28 08:40:42 cameron Exp $
  */
 
 #include "copyright.h"
@@ -53,8 +53,8 @@
     /* ghostbusted */
     me->p_ghostbuster = GHOSTTIME;
     ping_ghostbust = 0;
-    ERROR(2,("GHOSTBUSTED from ping: %c%c: %s@%s\n", 
-	     me->p_mapchars[0], me->p_mapchars[1], login, host));
+    ERROR(2,("%s: ghostbusted by ping loss\n", 
+	     me->p_mapchars));
     fflush(stderr);
   } else
 #endif /*PING*/
@@ -72,10 +72,7 @@
 #endif
 
   if (!testtime) {
-    ERROR(2,("input.c/resurrect: The client went away! (%s@%s)\n",
-	     me->p_login,
-	     me->p_monitor));
-    ERROR(2,("input.c/resurrect: I will attempt to resurrect him!\n"));
+    ERROR(2,("%s: input() commences resurrection\n", me->p_mapchars));
   }
 
   commMode = COMM_TCP;
@@ -94,8 +91,7 @@
     if (connectToClient(host, nextSocket)) break;
     if (((i>=5) && testtime) || 
 	((i>=6) && (!testtime))) {
-      ERROR(2,("input.c: Oh well, maybe I'm getting rusty! (%s@%s) exits\n",
-	       me ->p_login, me->p_monitor));
+      ERROR(2,("%s: input() giving up\n", me->p_mapchars));
       freeslot(me);
       exit(0);
     }
@@ -103,11 +99,11 @@
   if (testtime) {
     me->p_whydead = KQUIT;
     me->p_status = PEXPLODE;
-    ERROR(3,("User attempted to used old reserved.c\n"));
+    ERROR(3,("%s: user attempted to used old reserved.c\n", me->p_mapchars));
     new_warning(UNDEF,"Only RSA clients are valid. Please use a blessed one.");
   }
   else {
-    ERROR(2,("input.c/resurrect: A miracle! He's Alive!\n"));
+    ERROR(2,("%s: resurrected\n", me->p_mapchars));
     testtime = -1;	/* Do verification after GB  - NBT */
   }
   SIGNAL(SIGALRM, setflag);
Index: Vanilla/ntserv/main.c
diff -u Vanilla/ntserv/main.c:1.7 Vanilla/ntserv/main.c:1.8
--- Vanilla/ntserv/main.c:1.7	Thu May 20 21:30:12 1999
+++ Vanilla/ntserv/main.c	Fri May 28 03:40:42 1999
@@ -183,6 +183,7 @@
 
     me->p_process = getpid ();
     me->p_timerdelay = defskip;
+    me->p_mapchars[0] = 'L';
 
     myship = &me->p_ship;
     mystats = &me->p_stats;
Index: Vanilla/ntserv/ntscmds.c
diff -u Vanilla/ntserv/ntscmds.c:1.5 Vanilla/ntserv/ntscmds.c:1.6
--- Vanilla/ntserv/ntscmds.c:1.5	Wed May 19 17:54:59 1999
+++ Vanilla/ntserv/ntscmds.c	Fri May 28 03:40:42 1999
@@ -1,4 +1,4 @@
-/* $Id: ntscmds.c,v 1.5 1999/05/19 22:54:59 cameron Exp $
+/* $Id: ntscmds.c,v 1.6 1999/05/28 08:40:42 cameron Exp $
  */
 
 /*
@@ -198,23 +198,23 @@
 
     if (j->p_status == PFREE){
 	pmessage(sendto, mflags, addr_mess(who,MTEAM), 
-		"That player is not in the game");
+		"You cannot eject a free slot.");
 	return;
      }
     if (j->p_flags & PFROBOT) {
 	pmessage(sendto, mflags, addr_mess(players[who].p_team,MTEAM), 
-		"You cannot eject a robot, twinks!");
+		"You cannot eject a robot.");
 	return;
     }
     if (j->p_team != players[who].p_team){
       pmessage(players[who].p_team, MTEAM, 
 	addr_mess(players[who].p_team,MTEAM), 
-	"You can only eject your own teammates, twinks!");
+	"You can only eject your own teammates.");
       return;
     }
 
     pmessage(0, MALL, addr_mess(who,MALL), 
-	" %2s has been ejected by the players", j->p_mapchars);
+	" %2s has been ejected by their team", j->p_mapchars);
 
     eject_player(j->p_no);
 #if defined(VICIOUS_EJECT)
@@ -229,8 +229,6 @@
     } else {
       freeslot(j);
     }
-    pmessage(0, MALL, addr_mess(who, MALL),
-           "Freeing %2s slot. Continuum vicious code enabled", j->p_mapchars);
 #endif
 }
 
Index: Vanilla/ntserv/socket.c
diff -u Vanilla/ntserv/socket.c:1.10 Vanilla/ntserv/socket.c:1.11
--- Vanilla/ntserv/socket.c:1.10	Tue May 11 18:23:36 1999
+++ Vanilla/ntserv/socket.c	Fri May 28 03:40:42 1999
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.10 1999/05/11 23:23:36 ahn Exp $
+/* $Id: socket.c,v 1.11 1999/05/28 08:40:42 cameron Exp $
  */
 
 /*
@@ -347,11 +347,10 @@
 	shutdown(sock,2);
 	sock= -1;
     }
-    ERROR(3,("connectToClient: host %s port %d\n", machine, port)); 
+    ERROR(3,("%s:%s:%d start connect\n", me->p_mapchars, machine, port)); 
 
     if ((ns=socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-	ERROR(1,("connectToClient: cannot create a socket\n"));
-	perror("socket");
+	ERROR(1,("%s: socket() failed, %s\n", me->p_mapchars, strerror(errno)));
 	exit(2);
     }
 
@@ -362,8 +361,8 @@
 	addr.sin_addr.s_addr=remoteaddr;
     } else if ((addr.sin_addr.s_addr = inet_addr(machine)) == -1) {
 	if ((hp = gethostbyname(machine)) == NULL) {
-	    ERROR(1,("connectToClient: cannot get host name\n"));
-	    perror("connectToClient: gethostbyname");
+	    ERROR(1,("%s: gethostbyname() failed, %s\n", me->p_mapchars, 
+		     strerror(errno)));
 	    close(ns);
 	    exit(1);
 	} else {
@@ -382,7 +381,8 @@
     /* set the socket non-blocking */
     stat = ioctl(ns, FIONBIO, "in");
     if (stat < 0) {
-	perror("connectToClient: ioctl: FIONBIO");
+	ERROR(1,("%s: ioctl(FIONBIO) failed, %s\n", me->p_mapchars, 
+		 strerror(errno)));
 	close(ns);
 	return(0);
     }
@@ -390,9 +390,8 @@
     /* start a connection attempt */
     stat = connect(ns, &addr, sizeof(addr));
     if (stat < 0 && errno != EINPROGRESS) {
-	ERROR(3,("connectToClient: connect failure to port %d\n", port));
-	if (errorlevel > 3) perror("connectToClient: connect");
-	ERROR(5,("connectToClient: errno %d\n", errno));
+	ERROR(2,("%s: connect() failed, %s\n", me->p_mapchars, 
+		 strerror(errno)));
 	close(ns);
 	return(0);
     }
@@ -404,12 +403,13 @@
     FD_SET(ns, &writefds);
     stat = select(32,0,&writefds,0,&timeout); 
     if (stat < 0) {
-	perror("connectToClient: select");
+	ERROR(1,("%s: select() after connect() failed, %s\n", me->p_mapchars, 
+		 strerror(errno)));
 	close(ns);
 	return(0);
     }
     if (stat == 0) {
-	ERROR(3,("connectToClient: connect timed out to port %d\n", port));
+	ERROR(3,("%s: connect timed out\n", me->p_mapchars));
 	close(ns);
 	return(0);
     }
@@ -418,25 +418,24 @@
     derrnol = sizeof(derrno);
     stat = getsockopt(ns, SOL_SOCKET, SO_ERROR, &derrno, &derrnol);
     if (stat < 0) {
-	perror("connectToClient: getsockopt: SOL_SOCKET: SO_ERROR");
-	close(ns);
-	return(0);
+	derrno = errno;
     }
 
     switch (derrno) {
     case 0:
 	break;
     case ECONNREFUSED:
-	ERROR(3,("connectToClient: connect refused on port %d\n", port));
+	ERROR(3,("%s: connection refused\n", me->p_mapchars));
 	close(ns);
 	return(0);
     case ENETUNREACH:
-	ERROR(3,("connectToClient: network unreachable on port %d\n", port));
+	ERROR(3,("%s: network unreachable\n", me->p_mapchars));
 	close(ns);
 	return(0);
     case ETIMEDOUT:
     default:
-	if (errorlevel > 3) perror("connectToClient: connect");
+	ERROR(3,("%s: connect() failed, %s\n", me->p_mapchars, 
+		 strerror(errno)));
 	close(ns);
 	return(0);
     }
@@ -444,7 +443,8 @@
     /* set the socket blocking */
     stat = ioctl(ns, FIONBIO, "out");
     if (stat < 0) {
-	perror("connectToClient: ioctl: FIONBIO");
+	ERROR(1,("%s: ioctl(FIONBIO) failed, %s\n", me->p_mapchars, 
+		 strerror(errno)));
 	close(ns);
 	return(0);
     }
@@ -479,7 +479,7 @@
 #ifdef CHECKMESG
     if (logall) {
 	if (!mlog) mlog = fopen(MesgLog, "a");
-	if (!glog) perror(MesgLog);
+	if (!mlog) perror(MesgLog);
     }
     if (loggod) {
 	if (!glog) glog = fopen(GodLog,"a");
@@ -693,7 +693,8 @@
 #endif
     if (packet->type<1 || packet->type>NUM_SIZES || 
 	sizes[(int)packet->type]==0) {
-	ERROR(1,("Attempt to send strange packet %d  %d\n", packet->type,NUM_SIZES));
+	ERROR(1,("%s: attempt to send strange packet %d %d\n", me->p_mapchars,
+		 packet->type,NUM_SIZES));
 	return;
     }
     packetsSent[(int)packet->type]++;
@@ -705,7 +706,8 @@
 	if (bufptr-buf+size >= BUFSIZE) {
 	    t=bufptr-buf;
 	    if (gwrite(sock, buf, t) != t) {
-		perror("std gwrite failed, client marked dead ");
+		ERROR(1,("%s: gwrite(TCP) failed, %s, client marked dead\n",
+		       me->p_mapchars, strerror(errno)));
 		clientDead=1;
 	    }
 	    bufptr=buf;
@@ -760,7 +762,8 @@
 	    if (udpbufptr-udpbuf+size >= UDPBUFSIZE) {
 		t=udpbufptr-udpbuf;
 		if (gwrite(udpSock, udpbuf, t) != t) {
-		    perror("UDP gwrite failed, client marked dead once more");
+		    ERROR(1,("%s: gwrite(UDP) failed, %s, client marked dead once more\n",
+			     me->p_mapchars, strerror(errno)));
 #ifdef EXTRA_GB
 		    clientDead=1;
 #endif
@@ -794,7 +797,8 @@
 	    if (bufptr-buf+size >= BUFSIZE) {
 		t=bufptr-buf;
 		if (gwrite(sock, buf, t) != t) {
-		    perror("TCP gwrite failed, client marked dead");
+		    ERROR(1,("%s: critical gwrite(TCP) failed, %s, client marked dead\n",
+			     me->p_mapchars, strerror(errno)));
 		    clientDead=1;
 		}
 		bufptr=buf /*+ addSequence(buf)*/;
@@ -817,7 +821,8 @@
     if (bufptr != buf) {
 	t = bufptr - buf; /* GCC 2.4.5 Optimizer Bug don't touch this */
 	if (gwrite(sock, buf, t) != t) {
-	    perror("flushSockBuf: gwrite failed, client marked dead");
+	    ERROR(1,("%s: flush gwrite(TCP) failed, %s, client marked dead\n",
+		     me->p_mapchars, strerror(errno)));
 	    clientDead=1;
 	}
 	bufptr=buf /*+ addSequence(buf)*/;
@@ -845,7 +850,8 @@
 #endif
 	t=udpbufptr-udpbuf;
 	if (gwrite(udpSock, udpbuf, t) != t){
-	    perror("UDP flush gwrite failed, client marked dead once more");
+	    ERROR(1,("%s: flush gwrite(UDP) failed, %s, client marked dead\n",
+		     me->p_mapchars, strerror(errno)));
 #ifdef EXTRA_GB
 	    clientDead=1;
 #endif
@@ -952,14 +958,16 @@
         UDPDIAG(("portswap hack entered\n"));
         if (0 > recvfrom(asock, buf, BUFSIZ*2, MSG_PEEK,
                          (struct sockaddr *)&moo, &s)) {
-            perror("recvfrom");
+	    ERROR(1,("%s: portswap recvfrom() failed, %s\n",
+		     me->p_mapchars, strerror(errno)));
         }
         else {
             UDPDIAG(("client port is really %d\n", ntohs(moo.sin_port)));
             portswapflags |= 2;
             portswapflags &= ~4;
             if (0 > connect(asock, (struct sockaddr *)&moo, sizeof(moo))) {
-                perror("connect");
+		ERROR(1,("%s: portswap connect() failed, %s\n",
+			 me->p_mapchars, strerror(errno)));
             }
         }
     }
@@ -976,9 +984,8 @@
     if (count<=0) {
 #ifdef DEBUG
 	/* (this happens when the client hits 'Q') */
-	ERROR(1,( "1) read() failed in doRead (%d, error %d)\n",
-		  count, errno));
-	ERROR(1,( "asock=%d, sock=%d\n", asock, sock));
+	ERROR(1,("%s: read() failed, %s\n",
+		 me->p_mapchars, strerror(errno)));
 #endif
 	if (asock == udpSock) {
 	    if (errno == ECONNREFUSED) {
@@ -989,7 +996,8 @@
 		addr.sin_port = htons(udpClientPort);
 		addr.sin_family = AF_INET;
 		if (connect(udpSock, &addr, sizeof(addr)) < 0) {
-		    perror("hiccup connect");
+		    ERROR(1,("%s: hiccup connect() failed, %s\n",
+			     me->p_mapchars, strerror(errno)));
 		    UDPDIAG(("Unable to reconnect\n"));
 		    /* and fall through to disconnect */
 		} else {
@@ -1013,7 +1021,8 @@
     bufptr=buf;
     while (bufptr < buf+count) {
 	if (*bufptr < 1 || *bufptr > NUM_PACKETS || handlers[*bufptr].size==0) {
-	    ERROR(1,("Unknown packet type: %d, aborting...\n", *bufptr));
+	    ERROR(1,("%s: unknown packet type: %d, aborting...\n",
+		     me->p_mapchars, *bufptr));
 	    return (0);
 	}
 	size=handlers[*bufptr].size;
@@ -3043,7 +3052,7 @@
 void forceShutdown(int s)
 {
     SIGNAL (SIGALRM, SIG_IGN);
-    ERROR(1,("forceShutdown for %s@%s: %d\n", login, host,s));
+    ERROR(1,("%s: shutdown on signal %d\n", me->p_mapchars, s));
     shutdown (sock, 2);
     close (sock);
     if (udpSock >= 0)
Index: Vanilla/ntserv/solicit.c
diff -u Vanilla/ntserv/solicit.c:1.5 Vanilla/ntserv/solicit.c:1.6
--- Vanilla/ntserv/solicit.c:1.5	Fri Apr 30 15:18:46 1999
+++ Vanilla/ntserv/solicit.c	Fri May 28 03:40:43 1999
@@ -9,43 +9,10 @@
 #include "defs.h"
 #include "struct.h"
 #include "data.h"
+#include "solicit.h"
 
-/* bytes to reserve for outgoing packet to metaserver */
-#define MAXMETABYTES 2048
-
-/* maximum number of metaservers supported */
-#define MAXMETASERVERS 3
-
-/* minimum allowable delay between updates to metaserver */
-#define META_MINIMUM_DELAY 60
-/* Note: changing this may cause the metaserver to delist your server */
-
-/* maximum delay between updates to metaserver */
-#define META_MAXIMUM_DELAY 900
-
-/* ship classes (wish these were in data.c/data.h) */
-/* static char *ships[] = {"SC", "DD", "CA", "BB", "AS", "SB", "GA"}; */
-
-/* structure of information about a single metaserver */
-struct metaserver
-{
-  /* data items derived from metaservers file */
-  char host[32];		/* address of metaserver (DNS)		*/
-  int port;			/* port of metaserver			*/
-  int minimum;			/* minimum update time			*/
-  int maximum;			/* maximum update time			*/
-  char ours[32];		/* DNS address of server 	 	*/
-  char type[2];			/* server type code (B/P/C/H/?)		*/
-  int pport;			/* server main player port (e.g. 2592)	*/
-  int oport;			/* server observer player port		*/
-  char comment[32];		/* comment string			*/
-  
-  /* our own data about the communication with the metaserver */
-  int sock;			/* our socket number                    */
-  struct sockaddr_in address;	/* address of metaserver		*/
-  time_t sent;			/* date time metaserver last updated	*/
-  char prior[MAXMETABYTES];	/* prior packet sent			*/
-} metaservers[MAXMETASERVERS];
+/* our copy of .metaservers file */
+static struct metaserver metaservers[MAXMETASERVERS];
 
 /* initialisation done flag */
 static int initialised = 0;
Index: Vanilla/ntserv/sysdefaults.c
diff -u Vanilla/ntserv/sysdefaults.c:1.12 Vanilla/ntserv/sysdefaults.c:1.13
--- Vanilla/ntserv/sysdefaults.c:1.12	Fri Apr 30 15:18:46 1999
+++ Vanilla/ntserv/sysdefaults.c	Fri May 28 03:40:43 1999
@@ -1,4 +1,4 @@
-/* $Id: sysdefaults.c,v 1.12 1999/04/30 20:18:46 ahn Exp $
+/* $Id: sysdefaults.c,v 1.13 1999/05/28 08:40:43 cameron Exp $
  */
 
 #include <stdio.h>
@@ -128,11 +128,6 @@
 		break;
 	    }
 	}	
-
-	/* handle not finding it in the keyword list */
-	if (sysdef_keywords[j].type == SYSDEF_END) {
-	    ERROR(2,("System default %s unknown\n", buf));
-	}
     }
 
     /* Make sure every team can start at some planet! */