python-dbus-next icon indicating copy to clipboard operation
python-dbus-next copied to clipboard

message_bus's socket not closed when disconnect

Open yzm157 opened this issue 3 years ago • 0 comments

I get a resourcewarning problem, the message_bus's socket not closed when called disconnect. Now, I add two lines in disconnect function, please check it. @acrisci

def disconnect(self):
        """Disconnect the message bus by closing the underlying connection asynchronously.
        All pending  and future calls will error with a connection error.
        """
        self._user_disconnect = True
        try:
            self._sock.shutdown(socket.SHUT_RDWR)
        except Exception:
            logging.warning('could not shut down socket', exc_info=True)
        else:
             self._sock.close()

yzm157 avatar Feb 07 '22 12:02 yzm157