Fix hole punch parsing with no port.

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.
This commit is contained in:
Simon Howard 2020-03-07 18:56:15 -05:00
parent 0777aac061
commit 3cb43a5e5f

View file

@ -382,7 +382,10 @@ class MasterServer:
# a server that we have registered. # a server that we have registered.
_, server_addr_str = read_string(data) _, server_addr_str = read_string(data)
self.log_output(addr, "Hole punch request for %r" % server_addr_str) self.log_output(addr, "Hole punch request for %r" % server_addr_str)
if ":" in server_addr_str:
a, p = server_addr_str.split(":", 1) a, p = server_addr_str.split(":", 1)
else:
a, p = server_addr_str, 2342
server_addr = (a, int(p)) server_addr = (a, int(p))
if server_addr not in self.servers: if server_addr not in self.servers: