1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fixes bug with finding a free port.

This commit is contained in:
grossmj 2014-04-11 17:02:43 -06:00
parent e70ea26639
commit 862448ada1
2 changed files with 8 additions and 6 deletions

View File

@ -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,6 +362,9 @@ class DynamipsHypervisor(object):
return port
except OSError as e:
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
else:
raise DynamipsError("Could not find an unused port: {}".format(e))

View File

@ -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
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))