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

Less aggressive connections to uBridge. Ref #1289

This commit is contained in:
grossmj 2019-02-22 16:05:31 +07:00
parent a13d063aa1
commit 62c51edbae

View File

@ -69,7 +69,7 @@ class UBridgeHypervisor:
connection_success = False connection_success = False
last_exception = None last_exception = None
while time.time() - begin < timeout: while time.time() - begin < timeout:
yield from asyncio.sleep(0.01) yield from asyncio.sleep(0.1)
try: try:
self._reader, self._writer = yield from asyncio.open_connection(host, self._port) self._reader, self._writer = yield from asyncio.open_connection(host, self._port)
except OSError as e: except OSError as e:
@ -84,6 +84,7 @@ class UBridgeHypervisor:
log.info("Connected to uBridge hypervisor after {:.4f} seconds".format(time.time() - begin)) log.info("Connected to uBridge hypervisor after {:.4f} seconds".format(time.time() - begin))
try: try:
yield from asyncio.sleep(0.1)
version = yield from self.send("hypervisor version") version = yield from self.send("hypervisor version")
self._version = version[0].split("-", 1)[0] self._version = version[0].split("-", 1)[0]
except IndexError: except IndexError:
@ -237,7 +238,7 @@ class UBridgeHypervisor:
.format(host=self._host, port=self._port, command=command, run=self.is_running())) .format(host=self._host, port=self._port, command=command, run=self.is_running()))
else: else:
retries += 1 retries += 1
yield from asyncio.sleep(0.1) yield from asyncio.sleep(0.5)
continue continue
retries = 0 retries = 0
buf += chunk.decode("utf-8") buf += chunk.decode("utf-8")