This may fix "The semaphore timeout period has expired" error on Windows. #311.

This commit is contained in:
grossmj
2015-09-13 15:47:43 -06:00
parent 65fa4036c6
commit a9ac0d3380
2 changed files with 2 additions and 24 deletions

View File

@ -81,8 +81,8 @@ class DynamipsHypervisor:
while time.time() - begin < timeout: while time.time() - begin < timeout:
yield from asyncio.sleep(0.01) yield from asyncio.sleep(0.01)
try: try:
self._reader, self._writer = yield from asyncio.open_connection(host, self._port) self._reader, self._writer = yield from asyncio.wait_for(asyncio.open_connection(host, self._port), timeout=1)
except OSError as e: except (asyncio.TimeoutError, OSError) as e:
last_exception = e last_exception = e
continue continue
connection_success = True connection_success = True

View File

@ -30,8 +30,6 @@ class NIO(object):
def __init__(self): def __init__(self):
# create an unique name
self._name = 'nio-{}'.format(uuid.uuid4())
self._capturing = False self._capturing = False
self._pcap_output_file = "" self._pcap_output_file = ""
self._pcap_data_link_type = "" self._pcap_data_link_type = ""
@ -78,23 +76,3 @@ class NIO(object):
""" """
return self._pcap_data_link_type return self._pcap_data_link_type
def __str__(self):
"""
NIO string representation.
:returns: NIO name
"""
return self._name
@property
def name(self):
"""
Returns the NIO name.
:returns: NIO name
"""
return self._name