mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 09:18:08 +00:00
Fixes bug with finding a free port.
This commit is contained in:
parent
e70ea26639
commit
862448ada1
@ -351,8 +351,6 @@ class DynamipsHypervisor(object):
|
||||
socket_type = socket.SOCK_STREAM
|
||||
|
||||
for port in range(start_port, end_port):
|
||||
if port + 1 == end_port:
|
||||
raise DynamipsError("Could not find a free port between {0} and {1}".format(start_port, end_port))
|
||||
try:
|
||||
if ":" in host:
|
||||
# IPv6 address support
|
||||
@ -364,7 +362,10 @@ class DynamipsHypervisor(object):
|
||||
return port
|
||||
except OSError as e:
|
||||
if e.errno == errno.EADDRINUSE: # socket already in use
|
||||
continue
|
||||
if port + 1 == end_port:
|
||||
raise DynamipsError("Could not find a free port between {0} and {1}".format(start_port, end_port))
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
raise DynamipsError("Could not find an unused port: {}".format(e))
|
||||
|
||||
|
@ -793,8 +793,6 @@ class IOUDevice(object):
|
||||
socket_type = socket.SOCK_STREAM
|
||||
|
||||
for port in range(start_port, end_port):
|
||||
if port + 1 == end_port:
|
||||
raise IOUError("Could not find a free port between {0} and {1}".format(start_port, end_port))
|
||||
try:
|
||||
if ":" in host:
|
||||
# IPv6 address support
|
||||
@ -806,6 +804,9 @@ class IOUDevice(object):
|
||||
return port
|
||||
except OSError as e:
|
||||
if e.errno == errno.EADDRINUSE: # socket already in use
|
||||
continue
|
||||
if port + 1 == end_port:
|
||||
raise IOUError("Could not find a free port between {0} and {1}".format(start_port, end_port))
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
raise IOUError("Could not find an unused port: {}".format(e))
|
||||
|
Loading…
Reference in New Issue
Block a user