if not self.session.is_logged_in():
_moduleLogger.info("Received connection change event when not logged in")
return
- self._connRef().StatusChanged(
- telepathy.CONNECTION_STATUS_DISCONNECTED,
- telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR
- )
try:
- self._connRef().disconnect()
+ self._connRef().disconnect(telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR)
except Exception:
_moduleLogger.exception("Error durring disconnect")
self.__delayedDisconnectEventId = None
"""
For org.freedesktop.telepathy.Connection
"""
- self.StatusChanged(
- telepathy.CONNECTION_STATUS_DISCONNECTED,
- telepathy.CONNECTION_STATUS_REASON_REQUESTED
- )
try:
- self.disconnect()
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_REQUESTED)
except Exception:
_moduleLogger.exception("Error durring disconnect")
return props
- def disconnect(self):
+ def disconnect(self, reason):
_moduleLogger.info("Disconnecting")
+ # Not having the disconnect first can cause weird behavior with clients
+ # including not being able to reconnect or even crashing
+ self.StatusChanged(
+ telepathy.CONNECTION_STATUS_DISCONNECTED,
+ reason,
+ )
+
for plumber in self._plumbing:
plumber.stop()