Author: asterix Date: 2007-08-31 09:56:38 +0200 (Fri, 31 Aug 2007) New Revision: 8650
Modified: branches/gajim_0.11.1/src/common/zeroconf/connection_zeroconf.py Log: fix reconnect feature with zeroconf. fixes #3068 and #3076
Modified: branches/gajim_0.11.1/src/common/zeroconf/connection_zeroconf.py =================================================================== --- branches/gajim_0.11.1/src/common/zeroconf/connection_zeroconf.py 2007-08-31 07:53:01 UTC (rev 8649) +++ branches/gajim_0.11.1/src/common/zeroconf/connection_zeroconf.py 2007-08-31 07:56:38 UTC (rev 8650) @@ -64,7 +64,7 @@ self.call_resolve_timeout = False - #self.time_to_reconnect = None + self.time_to_reconnect = None #self.new_account_info = None self.bookmarks = []
@@ -127,6 +127,8 @@ gajim.handlers[event](self.name, data)
def _reconnect(self): + # Do not try to reco while we are already trying + self.time_to_reconnect = None gajim.log.debug('reconnect')
signed = self.get_signed_msg(self.status) @@ -199,6 +201,20 @@ self.status = 'offline' self.disconnect()
+ def _disconnectedReconnCB(self): + '''Called when we are disconnected. Comes from network manager for example + we don't try to reconnect, network manager will tell us when we can''' + log.debug('disconnectedReconnCB') + if gajim.account_is_connected(self.name): + # we cannot change our status to offline or connecting + # after we auth to server + self.old_show = STATUS_LIST[self.connected] + self.connected = 0 + self.dispatch('STATUS', 'offline') + # random number to show we wait network manager to send us a reconenct + self.time_to_reconnect = 5 + self.on_purpose = False + def _on_name_conflictCB(self, alt_name): self.disconnect() self.dispatch('STATUS', 'offline') @@ -300,6 +316,7 @@ # 'disconnect' elif show == 'offline' and self.connected: self.disconnect() + self.time_to_reconnect = None # update status elif show != 'offline' and self.connected: