Change address/host binding implementation.

This commit is contained in:
grossmj
2014-04-11 18:33:42 -06:00
parent 862448ada1
commit 3edbdbe0b5
6 changed files with 35 additions and 17 deletions

View File

@ -67,8 +67,17 @@ class DynamipsHypervisor(object):
Connects to the hypervisor.
"""
# connect to a local address by default
# if listening to all addresses (IPv4 or IPv6)
if self._host == "0.0.0.0":
host = "127.0.0.1"
elif self._host == "::":
host = "::1"
else:
host = self._host
try:
self._socket = socket.create_connection((self._host,
self._socket = socket.create_connection((host,
self._port),
self._timeout)
except OSError as e: