mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-30 04:53:47 +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):
|
||||
self._output = asyncio.StreamReader()
|
||||
self._closed = False
|
||||
self.transport = None
|
||||
|
||||
def read(self, n=-1):
|
||||
@ -54,9 +55,11 @@ class SerialReaderWriterProtocol(asyncio.Protocol):
|
||||
self.transport = transport
|
||||
|
||||
def data_received(self, data):
|
||||
self._output.feed_data(data)
|
||||
if not self._closed:
|
||||
self._output.feed_data(data)
|
||||
|
||||
def close(self):
|
||||
self._closed = True
|
||||
self._output.feed_eof()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user