mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-30 21:03:49 +02:00
Avoid a crash in some conditions when reading the serial console
This commit is contained in:
parent
897c9cb42c
commit
10b039074f
@ -34,6 +34,7 @@ class SerialReaderWriterProtocol(asyncio.Protocol):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._output = asyncio.StreamReader()
|
self._output = asyncio.StreamReader()
|
||||||
|
self._closed = False
|
||||||
self.transport = None
|
self.transport = None
|
||||||
|
|
||||||
def read(self, n=-1):
|
def read(self, n=-1):
|
||||||
@ -54,9 +55,11 @@ class SerialReaderWriterProtocol(asyncio.Protocol):
|
|||||||
self.transport = transport
|
self.transport = transport
|
||||||
|
|
||||||
def data_received(self, data):
|
def data_received(self, data):
|
||||||
self._output.feed_data(data)
|
if not self._closed:
|
||||||
|
self._output.feed_data(data)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
self._closed = True
|
||||||
self._output.feed_eof()
|
self._output.feed_eof()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user