Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] Ping patch
Home

[Freeciv-Dev] Ping patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Ping patch
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Sat, 17 Feb 2001 15:41:08 +0000 (WET)

This patch adds 2 things:

* added PACKET_CONN_PING & PACKET_CONN_PONG:
  PACKET_CONN_PING is sent by the server every GAME_DEFAULT_PINGTIMEOUT
  seconds to all clients.
  If the client doesn't reply with PACKET_CONN_PONG by the time the server
  tries to PING it again the client's connection is cut.

  GAME_DEFAULT_PINGTIMEOUT is 60 seconds right now.

  Since these packets don't include any info besides the type of the
  packet and there was already a packet type called PACKET_BEFORE_NEW_YEAR
  that was like this i renamed the functions & structs of that to
  .*packet_generic_empty to reuse code.

* Also, added a max size of MAX_LEN_BUFFER to the send buffers,
  if the send buffer gets bigger than 128kb the player's connection is cut.
  This is just in case something freaky happens & the send buffer starts
  eating mem like a black hole.

Of course, because of the ping packets, this breaks network protocol
compatibility.  Yes i know we can use the capability string and just not
send these packets to older clients but i don't want to do that.
I want everyone to be forced to have this behaviour.

PS: i didn't make the default ping timeout runtime user settable but that
should be easy to do.  Just add some stuff in server/stdinhand.c, etc.

Wow i nearly forgot to attach the patch again :O)

Comments, praise or criticism would be appreciated.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa

Attachment: freeciv-ping.diff.gz
Description: Binary data


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