From 1c13ceddb56471e5875f678823c8603782214bee Mon Sep 17 00:00:00 2001 From: elParaguayo Date: Sat, 7 Jan 2023 19:17:52 +0000 Subject: [PATCH] Close socket on disconnect As per issue #137, sockets are not closed when the bus is disconnected. This results in users receiving warnings about unclosed sockets. This PR adds a call to the socket's `close` method during `disconnect`. Closes #137 --- dbus_next/message_bus.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dbus_next/message_bus.py b/dbus_next/message_bus.py index 8bb830d..b78f612 100644 --- a/dbus_next/message_bus.py +++ b/dbus_next/message_bus.py @@ -386,6 +386,7 @@ def disconnect(self): self._user_disconnect = True try: self._sock.shutdown(socket.SHUT_RDWR) + self._sock.close() except Exception: logging.warning('could not shut down socket', exc_info=True)