Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2273) Server restart patch v3
Home

[Freeciv-Dev] (PR#2273) Server restart patch v3

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#2273) Server restart patch v3
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 12 Nov 2002 01:19:16 -0800
Reply-to: rt@xxxxxxxxxxxxxx

[per - Thu Nov  7 14:24:48 2002]:

> New version of the server restart patch (which makes the server
> re-entrant). I've committed the missing initializations of city names
> and the style fixes from the previous version, and moved a function so
> that diff generates less noise. This version should be _much_ more
readable.
> 
> Also fixed a bug in previous version which stopped autogames from
> working properly.

One thing I'm not entirely happy with conceptually is that autogames
(game.timeout==-1) will exit immediately after the game.  IMO the
ability to run autogames repeatedly would be a great benefit -
especially in debugging this patch.  On the other hand I can see that
usually you do not want more than one autogame to run.

I think the best way to deal with this would be to make it a server
option whether the game starts over.  Then the while (TRUE) {...} would
simply change to a do {...} while (game.restart_when_done).

This could be handled in a later patch; it should not stand in the way
of inlusion.

> I think the patch now should be ready to go in.

It seems like read_init_script should be called from within the loop. 
Certainly this is necessary to get autogames to work properly.  Or is
there a reason why this should not be done?

Finally, it bothers me that game_init() is called at the end of the loop
instead of the beginning.  IMO it would be cleaner to call this just
once, at the beginning of the loop.  But I'm not sure if this would be
correct - currently the game data is initialized before the network and
other once-only initializations.

-----

I changed the code around slightly so that autogames could be run
repeatedly.  Then I did this.  After about 5 minutes (with 20 second
games) it crashed.  I don't know if this is related to the patch (or my
changes) at all, though.

0  0x400e3eae in mallopt () from /lib/libc.so.6
(gdb) bt
#0  0x400e3eae in mallopt () from /lib/libc.so.6
#1  0x400e2e81 in free () from /lib/libc.so.6
#2  0x080b28da in ai_data_turn_done (pplayer=0x401877c0) at aidata.c:193
#3  0x080b292a in ai_data_get (pplayer=0x813325c) at aidata.c:206
#4  0x080b0f13 in ai_spend_gold (pplayer=0x813325c) at aicity.c:323
#5  0x080b15dc in ai_manage_cities (pplayer=0x813325c) at aicity.c:517
#6  0x080b367a in ai_do_last_activities (pplayer=0x813325c) at aihand.c:370
#7  0x0804d7d6 in end_turn ()
#8  0x080501c6 in main_loop ()
#9  0x080509a1 in srv_loop ()
#10 0x0805036d in srv_main ()
#11 0x0804a195 in main (argc=3, argv=0xbffff964) at civserver.c:153

jason



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