self.__channelManager.channel_for_props(publishProps, signal=True)
except gvoice.backend.NetworkError, e:
_moduleLogger.exception("Connection Failed")
- self.StatusChanged(
- telepathy.CONNECTION_STATUS_DISCONNECTED,
- telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR
- )
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_NETWORK_ERROR)
return
except Exception, e:
_moduleLogger.exception("Connection Failed")
- self.StatusChanged(
- telepathy.CONNECTION_STATUS_DISCONNECTED,
- telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED
- )
+ self.disconnect(telepathy.CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED)
return
_moduleLogger.info("Connected")
"""
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()