From 59c99097a234acf94299dd91991ec06808024d6b Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 13 Nov 2023 13:14:25 +0100 Subject: [PATCH] refactor: Use SHSDuplexStream.close instead of disconnect `disconnect()` is now deprecated to make the API more consistent. --- ssb/packet_stream.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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()