This fixes#1 where servers requiring hole punch would time out from
the leader board after several hours when the server refresh triggers.
Besides, it's also possible the server no longer needs hole punching.
If the port is the default port we won't include the :port part of
the server address. In this case we must assume the default port.
This should fix clients being unable to connect to servers when they
run on the default port and require hole punch assistance.
In the setup tool when querying all servers from the master server, we also
need to hole punch all servers which need it. Rather than doing this with
many individual hole punch requests to the master server, add a single new
message type to hole punch all servers.
This could have been done as part of the normal query request handling,
automatically hole punching all servers unrequested by the client.
However, clients need to hole punch again when connecting and older clients
do not know how to do this. Separating out the functionality means that
hole punching will only be performed for newer clients which know about it.
If a server is behind a NAT gateway, we might not get a response when
we send it a query. However, a hole punch request may make it accessible.
After two seconds with no response, try a hole punch request and if we get
a reply, retry the request.
We keep state on which servers require hole punching and only allow hole
punch requests from clients if they are flagged as such.
If a server is behind a NAT gateway or firewall its UDP port may be
accessible to the master server but not to other clients. For some types
of gateway we can work around this by having the servers explicitly send
a packet to the client that is trying to connect to them ("hole punching").
The master server can serve as a trampoline to forward this request from
clients.
This is the initial master server-side part of implementing
chocolate-doom/chocolate-doom#469.
from start messages. Include millisecond precision in the time fields of
the messages for extra accuracy. Log nonce values and demo hashes.
Subversion-branch: /master
Subversion-revision: 2519
a different socket before accepting their request. This blocks servers
that are behind NAT gateways and not globally accessible.
Subversion-branch: /master
Subversion-revision: 2188