Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23403/src

Modified Files:
	parsemeta.c 
Log Message:
Reduced lifetime for a server in cache from 20 to 5 client attempts to use metaserver.
20 was just too long especially in light of INL servers that pop on and off the metaserver
on a frequent basis.
Added check in savemetascache to not save servers that aren't responding to ping requests,
as they are either defunct, or the metacache entry for that server name is somehow corrupted.
Undid the change in order of loading metacache and receiving metaserver info, didn't see
any change in performance from the change.

Index: parsemeta.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- parsemeta.c	23 Jan 2007 11:12:05 -0000	1.27
+++ parsemeta.c	29 Jan 2007 10:34:23 -0000	1.28
@@ -581,7 +581,7 @@
       sp->port = port;
       sp->age = age;
       sp->when = now;
-      sp->lifetime = 4;
+      sp->lifetime = 2;
 #ifdef METAPING
       sp->ip_lookup = 0;
       /* Initialize the ping rtt fields */
@@ -595,12 +595,12 @@
 	sp->age = (int)now - (int)(sp->when-sp->age);
 	sp->when = now;
 	sp->refresh = 1;
-	sp->lifetime = 20;
+	sp->lifetime = 5;
 	continue;
       } else {
 	sp->age = age;
 	sp->when = now;
-	sp->lifetime = 20;
+	sp->lifetime = 5;
       }
     } 
     /* Use converted status and player values */
@@ -686,7 +686,7 @@
   sp->age = 0;
   sp->when = now;
   sp->refresh = 1;
-  sp->lifetime = 20;
+  sp->lifetime = 5;
   sp->players = players;
   sp->status = statusOpen;
   sp->typeflag = type;
@@ -839,6 +839,12 @@
          instead they default to "Active". */
       for (i = 0; i < num_servers; i++)
       {
+#ifdef METAPING	
+      	  /* Don't cache servers that aren't responding to ping, they are likely 
+      	     defunct. */
+      	  if (metaPing && serverlist[i].pkt_rtt[0] == -2)
+      	      continue;
+#endif
           sprintf(str,"%s,%d,%lld,%d,%d,%d,%d,%c\n",
           serverlist[i].address,
           serverlist[i].port,
@@ -1281,8 +1287,8 @@
     switch (type)
     {
         case 1:
-	    LoadMetasCache();
 	    ReadMetasSend();
+	    LoadMetasCache();
 	    if (num_servers == 0) ReadMetasRecv(-1);
 	    if (num_servers != 0) {
 	    	/* Allocate 4 spots for header/refresh/quit/link */