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:
yield from asyncio.sleep(0.01)
try:
self._reader, self._writer = yield from asyncio.open_connection(host, self._port)
except OSError as e:
self._reader, self._writer = yield from asyncio.wait_for(asyncio.open_connection(host, self._port), timeout=1)
except (asyncio.TimeoutError, OSError) as e:
last_exception = e
continue
connection_success = True