mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-30 09:38:53 +00:00
Different approach to handle no data returned by uBridge hypervisors. Fixes #1289.
This commit is contained in:
parent
7c14e21f4a
commit
00e781826b
@ -214,6 +214,8 @@ class UBridgeHypervisor:
|
|||||||
# Now retrieve the result
|
# Now retrieve the result
|
||||||
data = []
|
data = []
|
||||||
buf = ''
|
buf = ''
|
||||||
|
retries = 0
|
||||||
|
max_retries = 10
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
@ -229,11 +231,14 @@ class UBridgeHypervisor:
|
|||||||
log.warning("Connection reset received while reading uBridge response: {}".format(e))
|
log.warning("Connection reset received while reading uBridge response: {}".format(e))
|
||||||
continue
|
continue
|
||||||
if not chunk:
|
if not chunk:
|
||||||
if self.is_running():
|
if retries > max_retries:
|
||||||
log.warning("No data returned from {host}:{port}".format(host=self._host, port=self._port))
|
raise UbridgeError("No data returned from {host}:{port}, uBridge process running: {run}"
|
||||||
|
.format(host=self._host, port=self._port, run=self.is_running()))
|
||||||
|
else:
|
||||||
|
retries += 1
|
||||||
|
yield from asyncio.sleep(0.1)
|
||||||
continue
|
continue
|
||||||
raise UbridgeError("No data returned from {host}:{port}, uBridge process running: {run}"
|
retries = 0
|
||||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
|
||||||
buf += chunk.decode("utf-8")
|
buf += chunk.decode("utf-8")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise UbridgeError("Lost communication with {host}:{port} :{error}, uBridge process running: {run}"
|
raise UbridgeError("Lost communication with {host}:{port} :{error}, uBridge process running: {run}"
|
||||||
|
Loading…
Reference in New Issue
Block a user