* Don't set Game's `hosts` value to a list of ''exactly'' 3
- Instead use empty strings for non-existing hostnames below 3 (when encoding only)
- This allows for a bit more extensibility in the future.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7365 4a71c877-e1ca-e34f-864e-861f7616d084
* Add a new field: secondaryHosts, an array of two fallback hosts
- Canibalize the entire "misc" field and part of the "extra" field for this
- When connecting, first try the primary "host" field, then fall back to the hosts in secondaryHosts (in order)
* Add a new field: gameId, used on the lobby server to link multiple lobby connections to a single game entry
- First (attempt to) connect to the lobby with all available address families (currently IPv4 and IPv6)
- Then ask for a gameId from the lobby server using the first established lobby connection
- Set the gameId field in the GAMESTRUCT to the one retrieved
- Transmit the GAMESTRUCT using a "addg" command to the lobby over each lobby connection
- The lobby then compares all incoming ID numbers with ID numbers already present
- If there's a match it will use the GAMESTRUCT already present and only add a new hostname to the list
This is the last change, part of, and closes#452
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7364 4a71c877-e1ca-e34f-864e-861f7616d084
* Make the "addg" command return a status code (ranging 200-299 on success) and message (MOTD on succes)
* Don't use the "motd" command anymore to check the lobby status, instead use the returned status code for that purpose.
* Allow MOTD strings of arbitrary length (by sending along the length)
This modification ensures that ''proper'' connectivity checking is being performed on the game server (and reported to the user accurately).
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7323 4a71c877-e1ca-e34f-864e-861f7616d084
* Create another custom context manager (can be used in with-statement) for creating a connection to a given (host, port): "connection"
- Perform manual name-resolution, using each returned entry until one can be succesfully connected to (allows IPv4 + IPv6 through the same function)
* Use this context manager instead of connecting manually
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7305 4a71c877-e1ca-e34f-864e-861f7616d084
* Use select(2) to wait for a connection on both sockets and accept(2)ing them in a separate thread
* This prevents IPv4 addresses from becoming IPv6 mapped, which might not be properly supported on all platforms
- The IPv6 mapped addresses where transferred back to clients
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7264 4a71c877-e1ca-e34f-864e-861f7616d084
* Also disable IPV6_V6ONLY to make sure that (on systems that support the option) IPv4 is still supported, using the same socket
- This option works on Linux from 2.4.21 and 2.6 (according to "man ipv6")
- On FreeBSD this works from version 6 onward (lower versions might work, I only tested on 6 and 7 and didn't find any note in the manual)
- Furthermore, according to
http://en.wikipedia.org/wiki/IPv4_mapped_address:
* This works on Windows from Vista onward
* This works on NetBSD (version unspecified)
* This doesn't work on OpenBSD (as a design decision for security)
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7225 4a71c877-e1ca-e34f-864e-861f7616d084
- Make sure to use the maxPlayers and currentPlayers variables found in the Game class, not the (non-existing) local variables
* Don't use Game.check() as it doesn't exist, use Protocol.check(Game) instead
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7224 4a71c877-e1ca-e34f-864e-861f7616d084
* This removes the need to specify what type of protocol (e.g. BinaryProtocol vs. JsonProtocol) should be used
- Instead only the (Warzone) version needs to be specified, the constructor function (Protocol()) will figure out the correct protocol class to use
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7217 4a71c877-e1ca-e34f-864e-861f7616d084
- This removes the requirement for the socket handler to be aware of the size of a single game
- I.e. this allows variable sized games without another API change
* Read and write Protocol data directly from and to the sockets, decoding and encoding on the fly
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7209 4a71c877-e1ca-e34f-864e-861f7616d084