DescriptionAmanieu d'Antras
2009-02-12 08:25:03 EST
getinfo response packets (used for ping) are handled at the beginning of the common frame, but before the client frame. Therefore cls.realtime is still set to the time of the previous frame. When the packet is handled, the time is compared to cls.realtime, which is of course off by one frame. This is the cause of the strange 1 ping servers on the server list. Patch:
--- trunk/src/client/cl_main.c 2009/02/12 00:41:12 306
+++ trunk/src/client/cl_main.c 2009/02/12 13:15:20 307
@@ -3687,6 +3687,7 @@
char info[MAX_INFO_STRING];
char *infoString;
int prot;
+ int realmsec = Sys_Milliseconds();
infoString = MSG_ReadString( msg );
@@ -3703,7 +3704,7 @@
if ( cl_pinglist[i].adr.port && !cl_pinglist[i].time && NET_CompareAdr( from, cl_pinglist[i].adr ) )
{
// calc ping time
- cl_pinglist[i].time = cls.realtime - cl_pinglist[i].start + 1;
+ cl_pinglist[i].time = realmsec - cl_pinglist[i].start + 1;
Com_DPrintf( "ping time %dms from %s\n", cl_pinglist[i].time, NET_AdrToString( from ) );
// save of info
Looks alright to me. I don't think you need a new local variable though.
Also this doesn't address the separate issue of your ping times being quantised into whatever your frame period is... of course that's a more complicated problem and should probably be in a separate report.
Comment 4Zachary J. Slater
2009-07-04 15:45:33 EDT
Fixed in 3966 with a slightly different patch via Amanieu in IRC.
Comment 5Zachary J. Slater
2009-07-04 16:25:20 EDT
Created attachment 2089[details]
Fix for previous patch
I forgot that there was another part to that patch. Here is another patch to apply on top of the one already applied.
Comment 7Zachary J. Slater
2009-07-07 18:13:24 EDT
Created attachment 2089 [details] Fix for previous patch I forgot that there was another part to that patch. Here is another patch to apply on top of the one already applied.