mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-30 21:03:49 +02:00
Fixes #171.
This commit is contained in:
parent
359abb0286
commit
f6bc823b58
@ -276,15 +276,16 @@ class DynamipsHypervisor:
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
line = yield from self._reader.readline()
|
#line = yield from self._reader.readline() # this can lead to ValueError: Line is too long
|
||||||
|
chunk = yield from self._reader.read(1024) # match to Dynamips' buffer size
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
# task has been canceled but continue to read
|
# task has been canceled but continue to read
|
||||||
# any remaining data sent by the hypervisor
|
# any remaining data sent by the hypervisor
|
||||||
continue
|
continue
|
||||||
if not line:
|
if not chunk:
|
||||||
raise DynamipsError("No data returned from {host}:{port}, Dynamips process running: {run}"
|
raise DynamipsError("No data returned from {host}:{port}, Dynamips process running: {run}"
|
||||||
.format(host=self._host, port=self._port, run=self.is_running()))
|
.format(host=self._host, port=self._port, run=self.is_running()))
|
||||||
buf += line.decode("utf-8")
|
buf += chunk.decode("utf-8")
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise DynamipsError("Lost communication with {host}:{port} :{error}, Dynamips process running: {run}"
|
raise DynamipsError("Lost communication with {host}:{port} :{error}, Dynamips process running: {run}"
|
||||||
.format(host=self._host, port=self._port, error=e, run=self.is_running()))
|
.format(host=self._host, port=self._port, error=e, run=self.is_running()))
|
||||||
|
Loading…
Reference in New Issue
Block a user