The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Ashley on February 18, 2012, 03:26:36 PM

Title: Network patch - improve logging + remove use of NTOP/PTON
Post by: Ashley on February 18, 2012, 03:26:36 PM
This patch does a few things:

1. Improves logging for server startup, printing out which addresses the server is listening on (before these were mere debug messages which could be missed).
2. The server fails to start if it cannot listen on any of the addresses specified in the config file. I feel that this should be an error condition since it indicates that the server probably shouldn't be running (e.g. if there is another server bound to the same ports).
3. I've removed the code which uses inet_ntop and inet_pton - this was really unnecessary given that getaddrinfo() does validation (and indeed permits domain names) and getnameinfo() can be made to return numeric IPs by specifying the NI_NUMERICHOST flag (this was incorrectly set to the NI_NUMERICSERV flag in the code).
4. As a result, you can specify a DNS name in the listen directive of simuconf.tab, which will be resolved into IP addresses all of which will then be listened on. This is nice for flexible configuration.
Title: Re: Network patch - improve logging + remove use of NTOP/PTON
Post by: Dwachs on February 18, 2012, 04:04:08 PM
thank you!