From 2f364ecdba037263f1b82a174e6e3f3c78eabca4 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 12 May 2004 13:12:39 +0000 Subject: [PATCH] bugfix : when a server become unavailable, self.connexions's size changed during process. Now it changes after process. --- core/core.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/core.py b/core/core.py index 6008f60a1..501663a5b 100644 --- a/core/core.py +++ b/core/core.py @@ -174,11 +174,10 @@ class GajimCore: def disconnectedCB(self, con): """Called when we are disconnected""" log.debug("disconnectedCB") - if self.connected[self.connexions[con]] == 1: - self.connected[self.connexions[con]] = 0 - self.hub.sendPlugin('STATUS', self.connexions[con], 'offline') if self.connexions.has_key(con): - del self.connexions[con] + if self.connected[self.connexions[con]] == 1: + self.connected[self.connexions[con]] = 0 + self.hub.sendPlugin('STATUS', self.connexions[con], 'offline') # END disconenctedCB def connect(self, account): @@ -455,6 +454,14 @@ class GajimCore: for con in self.connexions: if self.connected[self.connexions[con]] == 1: con.process(1) + #remove connexion that have been broken + for acc in self.connected: + if self.connected[acc]: + break + for con in self.connexions: + if self.connexions[con] == acc: + del self.connexions[con] + break time.sleep(0.1) # END main # END GajimCore