use listenOnUnused instead of allocate_tcp_port in create_control_tub

This commit is contained in:
Jean-Paul Calderone 2019-04-16 11:26:42 -04:00
parent 9a30eaa83c
commit 6ea1684995

View File

@ -680,12 +680,8 @@ def create_control_tub():
port or location
"""
control_tub = Tub()
portnum = iputil.allocate_tcp_port()
port = "tcp:%d:interface=127.0.0.1" % portnum
location = "tcp:127.0.0.1:%d" % portnum
control_tub.listenOn(port)
control_tub.setLocation(location)
log.msg("Control Tub location set to %s" % (location,))
portnum = iputil.listenOnUnused(control_tub)
log.msg("Control Tub location set to 127.0.0.1:%s" % (portnum,))
return control_tub