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
|
||||
data = []
|
||||
buf = ''
|
||||
retries = 0
|
||||
max_retries = 10
|
||||
while True:
|
||||
try:
|
||||
try:
|
||||
@ -229,11 +231,14 @@ class UBridgeHypervisor:
|
||||
log.warning("Connection reset received while reading uBridge response: {}".format(e))
|
||||
continue
|
||||
if not chunk:
|
||||
if self.is_running():
|
||||
log.warning("No data returned from {host}:{port}".format(host=self._host, port=self._port))
|
||||
if retries > max_retries:
|
||||
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
|
||||
raise UbridgeError("No data returned from {host}:{port}, uBridge process running: {run}"
|
||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
||||
retries = 0
|
||||
buf += chunk.decode("utf-8")
|
||||
except OSError as e:
|
||||
raise UbridgeError("Lost communication with {host}:{port} :{error}, uBridge process running: {run}"
|
||||
|
Loading…
Reference in New Issue
Block a user