Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2000:
[Freeciv-Dev] Freeciv network code
Home

[Freeciv-Dev] Freeciv network code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Freeciv network code
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Thu, 2 Mar 2000 19:21:42 +0000 (WET)

As part of the problems with Freeciv's network code (blocking and possible
incomplete writes) i took a look at the low level network code.


The patch for packets.c fixes the incomplete writes problem and has some
minor cleanups.


The patch for sernet.c cleans up the code somewhat.
Also included is the patch to show the IP adress of a player without 
a reverse DNS entry instead of "Unknown" by Robert Brady
<rwb197@xxxxxxxxxxxxxxx>.
Please verify this code since i changed the code after the 'select' call a
bit becomes this seemed like the right way to me.
I've also included some more error messages.


The patch for meta.c changes the connection method somewhat, and cleans up
the code a bit i'm assuming the server doesn't connect to more than one
metaserver at any given time, also: am i right to assume that the
metaserver doesn't send anything back to the client?  It seems like so.

The Mac metaserver code doesn't seem to be right to me, however since i
never coded for the Mac i would appreciate some feedback by the Mac code
author.


I did some testing on the code changes i made and they seem to be fine.

Whenever i finish & test the preliminary non-blocking sockets, i'll also
send it.  I will look at porting the server to Win32 later; i ported it
once, but i'll look at it again and probably send a patch later.


PS: I've noticed some redundant calls in the client and server code to
do host name lookups:

=== clinet.c, line 100
  if(isdigit((size_t)*hostname)) {
    if((address = inet_addr(hostname)) == -1) {
      mystrlcpy(errbuf, _("Invalid hostname"), n_errbuf);
      return -1;
    }
    src.sin_addr.s_addr = address;
    src.sin_family = AF_INET;
  }
  else if ((ph = gethostbyname(hostname)) == NULL) {
    mystrlcpy(errbuf, _("Failed looking up host"), n_errbuf);
    return -1;
  }

The 'inet_addr' is redundant since 'gethostbyname' does its job.

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

Attachment: meta.diff.gz
Description: Binary data

Attachment: sernet.diff.gz
Description: Binary data

Attachment: packets.diff.gz
Description: Binary data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Freeciv network code, Vasco Alexandre Da Silva Costa <=