transit: don't use hard-coded listening ports

This commit is contained in:
Brian Warner 2015-02-20 00:00:27 -08:00
parent e4390859d1
commit 3171a4bb56

View File

@ -153,7 +153,7 @@ class Common:
self._start_server() self._start_server()
def _start_server(self): def _start_server(self):
server = MyTCPServer(("",self.server_port), None) server = MyTCPServer(("", 0), None)
_, port = server.server_address _, port = server.server_address
self.my_direct_hints = ["%s,%d" % (addr, port) self.my_direct_hints = ["%s,%d" % (addr, port)
for addr in ipaddrs.find_addresses()] for addr in ipaddrs.find_addresses()]
@ -245,9 +245,7 @@ class Common:
skt.close() skt.close()
class TransitSender(Common): class TransitSender(Common):
server_port = 9999
is_sender = True is_sender = True
class TransitReceiver(Common): class TransitReceiver(Common):
server_port = 9998
is_sender = False is_sender = False