X-Git-Url: http://git.maemo.org/git/?p=theonering;a=blobdiff_plain;f=src%2Fconnection.py;h=236dc9a7df28a579f167a9171a16cf262e302067;hp=fc62020f10d237b6c4632b73b40d29dc38f1c459;hb=f7ab8d4307b8418dec52a4dbaa82d72c3cd81a36;hpb=1cc0604ffca40bbfaee12c9fb5dc702fe921bb8c diff --git a/src/connection.py b/src/connection.py index fc62020..236dc9a 100644 --- a/src/connection.py +++ b/src/connection.py @@ -138,10 +138,13 @@ class TheOneRingConnection( autogv.NewGVConversations(weakref.ref(self)), autogv.RefreshVoicemail(weakref.ref(self)), autogv.AutoDisconnect(weakref.ref(self)), + autogv.DelayEnableContactIntegration(constants._telepathy_implementation_name_), ] self._delayedConnect = gobject_utils.Async(self._delayed_connect) _moduleLogger.info("Connection to the account %s created" % account) + self._timedDisconnect = autogv.TimedDisconnect(weakref.ref(self)) + self._timedDisconnect.start() @property def manager(self): @@ -188,6 +191,7 @@ class TheOneRingConnection( return _moduleLogger.info("Kicking off connect") self._delayedConnect.start() + self._timedDisconnect.stop() @misc_utils.log_exception(_moduleLogger) def _delayed_connect(self): @@ -279,6 +283,7 @@ class TheOneRingConnection( _moduleLogger.info("Disconnecting") self._delayedConnect.cancel() + self._timedDisconnect.stop() # Not having the disconnect first can cause weird behavior with clients # including not being able to reconnect or even crashing @@ -297,4 +302,9 @@ class TheOneRingConnection( self.session.logout() self.session.close() + # In case one of the above items takes too long (which it should never + # do), we leave the starting of the shutdown-on-idle counter to the + # very end + self.manager.disconnect_completed() + _moduleLogger.info("Disconnected")