Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] server i/o, take 3
Home

[Freeciv-Dev] server i/o, take 3

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] server i/o, take 3
From: Lauri Tarkkala <ltarkkal@xxxxxxxxxxxxxxx>
Date: Sun, 13 Aug 2000 22:32:08 +0300

Attached is yet anothet patch making server output towards
client asynch. This patch is based on the "net2" patch by
"Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>" and
also contains the "clistat" patch I posted earlier. The
patch is against CVS freeciv (2000-08-13).

The net2 patch had some slight problems, which this fixes
+ the "netwait" parameter was not very useful, the time a server
  might block while waiting for buffers to flush depended on 
  the number of times flush_packets() was called, which the
  user really can not know.
+ flush_packets() always listened to all write sockets, causing
  unnecessary cpu cycles to be wasted, if there was nothing
  buffered.
+ flush_packets() did not listen to the server console input.
  This could be annoying if, "netwait" was set to a higher
  value..

This patch also features a rewrite of sniff_packets()
and flush_packets(). sniff_packets() and flush_packets() interfaces
are as in the "net2", but they have now been split into several
functions. IMHO the i/o code is now fairly clean and easy to
understand, it is not close to perfection, but it should now
be far easier to modify, port, extend and/or understand.  

I even commented the structure of new code ;-)

No funtionality should have been destroyed, I attempted to keep
it all intact, and hopefully even succeeded.

The net2 + clistat patch was tested in a 4 player game, last
night, and now real problems occurred. I tested this using
some AI/AI games, and found no immediate problems.

This should solve the problems with packets being lost
easily (before adding flush_packets(), the server actually
could drop packets upon starting a normal game (found
this out while coding clistat)) and the server blocking
due to low throughput clients. 

The patch adds the "clistat" command, the "tcptimeout" 
and "netwait" parameters.

Lauri

-- 
"The credit belongs to the man in the arena whose face is marred by dust and
sweat and blood, who strives valiantly, who errs, and who comes up short again
and again, who knows the great enthusiasms, the great devotions, and spends
himself in a worthy cause. The man who at best knows the triumph of high
achievement and who at worst, if he fails, fails while daring greatly, so that
his place will never be with those cold timid souls who never knew victory or
defeat." - Theodore Roosevelt

Attachment: freeciv-net3.patch.gz
Description: application/gunzip


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] server i/o, take 3, Lauri Tarkkala <=