Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] (PR#16036) timeout client bug
Home

[Freeciv-Dev] (PR#16036) timeout client bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#16036) timeout client bug
From: "Jaroslav Libák" <jarol1@xxxxxxxxx>
Date: Sun, 26 Mar 2006 02:40:21 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16036 >

Hi

Freeciv 2.0.8 (also previous versions) client has a very inaccurate timeout 
counter. If you use CMA a lot, or do massive attacks turns can end even though 
there are still 10 seconds remaining.
The problem is, client updates the timeout if it receives a packet from the 
server with game information (that includes timeout), but sometimes that packet 
can have big delay beacuse Freeciv is single threaded and is busy with CMA. So 
if a packet arrives but cannot be processed by Freeciv and is delayed by 10 
seconds, and says 20 seconds are remaining, upon processing client will think 
there is 20 seconds left while it's only 10.

This is already fixed in warclient by remembering the time of the first packet 
with timeout as a first thing when packet arrives to minimize error. Then when 
we need to change timeout in the 0.5s timer we just read the current time and 
subtract initial time from it. This introduces 0.5s inaccuracy into the 
timeout, because timeout is not updated immediately when the clock ticks, but 
instead in the 0.5s timer which is not syncronized with the clock.
Then when a packet with a new timeout information arrives from the server, we 
try to estimate the initial time (when the turn really began) from it, and if 
it's older we update initial time (new initial time is more accurate), 
otherwise we keep initial time (new initial time is inaccurate due to packet 
delay). There is also a flag to ensure update of timeout when the game begins 
or when observer starts observing.

This fix makes timeout much more accurate, and if you have reasonably fast 
computer, turns usually end when there is 0 second left (sometimes 1s, but that 
is due to the mentioned 0.5s error + packet delay which we don't know).





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#16036) timeout client bug, Jaroslav Libák <=