From b25ac3c24009d1bcea0b2df10d222c5e4483eec3 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 26 May 2020 00:52:41 +0100 Subject: [PATCH] Check transport is not closing before writing to it --- houdini/spheniscidae.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/houdini/spheniscidae.py b/houdini/spheniscidae.py index de80e7c..768c104 100644 --- a/houdini/spheniscidae.py +++ b/houdini/spheniscidae.py @@ -79,8 +79,9 @@ class Spheniscidae: await self.send_line(xml_data.decode('utf-8')) async def send_line(self, data): - self.logger.debug(f'Outgoing data: {data}') - self.__writer.write(data.encode('utf-8') + Spheniscidae.Delimiter) + if not self.__writer.is_closing(): + self.logger.debug(f'Outgoing data: {data}') + self.__writer.write(data.encode('utf-8') + Spheniscidae.Delimiter) async def close(self): self.__writer.close()