Check transport is not closing before writing to it

This commit is contained in:
Ben 2020-05-26 00:52:41 +01:00
parent dbf7e4d35e
commit b25ac3c240

View File

@ -79,6 +79,7 @@ class Spheniscidae:
await self.send_line(xml_data.decode('utf-8')) await self.send_line(xml_data.decode('utf-8'))
async def send_line(self, data): async def send_line(self, data):
if not self.__writer.is_closing():
self.logger.debug(f'Outgoing data: {data}') self.logger.debug(f'Outgoing data: {data}')
self.__writer.write(data.encode('utf-8') + Spheniscidae.Delimiter) self.__writer.write(data.encode('utf-8') + Spheniscidae.Delimiter)