Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv16125/src Modified Files: parsemeta.c Log Message: Minor release date updates. Formalize max lifetime for servers in cache. Check against out of bounds lifetime before saving. Index: parsemeta.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- parsemeta.c 4 Mar 2007 22:27:13 -0000 1.34 +++ parsemeta.c 7 Mar 2007 00:11:46 -0000 1.35 @@ -71,6 +71,7 @@ static int seen = 0; /* number of replies seen */ static int type; /* type of connection requested */ #define RTT_AVG_BUFLEN 5 /* number of samples used for average rtt time */ +#define MAX_LIFETIME 5 /* max # connects for server to stay in cache */ /* from meta.h of metaserver code */ #define SS_WORKING 0 @@ -598,12 +599,12 @@ sp->age = (int)now - (int)(sp->when-sp->age); sp->when = now; sp->refresh = 1; - sp->lifetime = 5; + sp->lifetime = MAX_LIFETIME; continue; } else { sp->age = age; sp->when = now; - sp->lifetime = 5; + sp->lifetime = MAX_LIFETIME; } } /* Use converted status and player values */ @@ -689,7 +690,7 @@ sp->age = 0; sp->when = now; sp->refresh = 1; - sp->lifetime = 5; + sp->lifetime = MAX_LIFETIME; sp->players = players; sp->status = statusOpen; sp->typeflag = type; @@ -854,7 +855,8 @@ serverlist[i].port, serverlist[i].when, serverlist[i].age, - serverlist[i].lifetime, + // Protect against corrupted data so at least lifetimes clear quickly + ((serverlist[i].lifetime > MAX_LIFETIME) ? MAX_LIFETIME : serverlist[i].lifetime), serverlist[i].players, ((serverlist[i].status <= statusNull) ? serverlist[i].status : statusNull), serverlist[i].typeflag);