Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2002:
[Freeciv-Dev] Re: client core
Home

[Freeciv-Dev] Re: client core

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: client core
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Fri, 13 Sep 2002 16:37:28 +0200

On Thu, Sep 12, 2002 at 02:46:33PM +0200, Raimar Falke wrote:
> On Mon, Sep 09, 2002 at 01:05:31PM +0200, Raimar Falke wrote:
> > It is a band-aid. Like so much else. I will post a proper patch
> > shortly.
> 
> And the patch. Basically we don't work on pointers to structs anymore
> in agents.c but with the ids. The agents have to do lookups and check
> if the unit/cities are still alive.

It turns out that there is another problem: we may get remove_unit
packets for units we don't know (anymore).

The attached patch fixes this by making the unit handling similar to
the city handling:
 - client_remove_unit get a pointer (which is non-NULL) instead of the
 int
 - handle_remove_unit does the check similar to handle_remove_city if
 we know anything about this unit at all

Nevertheless the problem that the first version fixes is still there:
 - client sends a unit move request
 - server sends PACKET_PROCESSING_STARTED
   - agents get frozen
 - the unit attacks and is destroyed
 - server sends PACKET_REMOVE_UNIT
   - agents_unit_remove is called
     - the call is added
     - because of the frozen state the call isn't dispatched
   - client_remove_unit is called
     - the unit is removed
 - server sends PACKET_PROCESSING_FINISHED
   - agents get thawn
     - the remove-unit call is still un-dispatched
     - the remove-unit call is dispatched and BOOM the pointer that
     agents.c has is a stale one. The new version just saves the id
     and agents have to check if the object still exists.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Microsoft DNS service terminates abnormally when it recieves a response
  to a DNS query that was never made.
  Fix Information: Run your DNS service on a different platform."
    -- MS service information on bugtraq


[Prev in Thread] Current Thread [Next in Thread]