diff --git a/ssb/packet_stream.py b/ssb/packet_stream.py index 2d96827..549ac80 100644 --- a/ssb/packet_stream.py +++ b/ssb/packet_stream.py @@ -229,7 +229,7 @@ class PacketStream: if not read_data: logger.debug("DISCONNECT") - self.connection.disconnect() + self.connection.close() return None @@ -240,7 +240,8 @@ class PacketStream: return PSMessage.from_header_body(flags, req, body) except StopAsyncIteration: logger.debug("DISCONNECT") - self.connection.disconnect() + self.connection.close() + return None async def read(self) -> Optional[PSMessage]: @@ -314,4 +315,4 @@ class PacketStream: """Disconnect the stream""" self._connected = False - self.connection.disconnect() + self.connection.close()