mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28: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
|
socket_type = socket.SOCK_STREAM
|
||||||
|
|
||||||
for port in range(start_port, end_port):
|
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:
|
try:
|
||||||
if ":" in host:
|
if ":" in host:
|
||||||
# IPv6 address support
|
# IPv6 address support
|
||||||
@ -364,6 +362,9 @@ class DynamipsHypervisor(object):
|
|||||||
return port
|
return port
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == errno.EADDRINUSE: # socket already in use
|
if e.errno == errno.EADDRINUSE: # socket already in use
|
||||||
|
if port + 1 == end_port:
|
||||||
|
raise DynamipsError("Could not find a free port between {0} and {1}".format(start_port, end_port))
|
||||||
|
else:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
raise DynamipsError("Could not find an unused port: {}".format(e))
|
raise DynamipsError("Could not find an unused port: {}".format(e))
|
||||||
|
@ -793,8 +793,6 @@ class IOUDevice(object):
|
|||||||
socket_type = socket.SOCK_STREAM
|
socket_type = socket.SOCK_STREAM
|
||||||
|
|
||||||
for port in range(start_port, end_port):
|
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:
|
try:
|
||||||
if ":" in host:
|
if ":" in host:
|
||||||
# IPv6 address support
|
# IPv6 address support
|
||||||
@ -806,6 +804,9 @@ class IOUDevice(object):
|
|||||||
return port
|
return port
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno == errno.EADDRINUSE: # socket already in use
|
if e.errno == errno.EADDRINUSE: # socket already in use
|
||||||
|
if port + 1 == end_port:
|
||||||
|
raise IOUError("Could not find a free port between {0} and {1}".format(start_port, end_port))
|
||||||
|
else:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
raise IOUError("Could not find an unused port: {}".format(e))
|
raise IOUError("Could not find an unused port: {}".format(e))
|
||||||
|
Loading…
Reference in New Issue
Block a user