changeset 79:73a30fc1922b

Fixed the XMPP loop (release the lock) Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sat, 05 Sep 2009 00:15:50 +0200
parents a8749705fe94
children 4e18b435566a
files bot.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bot.py
+++ b/bot.py
@@ -76,6 +76,7 @@ class bot(Thread):
 		"""[Internal] XMPP infinite loop."""
 		i = 1
 		while True:
+			unlock = False
 			try:
 				if len(self.xmpp_connections) == 1:
 					sleep(0.5)  # avoid bot connection being locked all the time
@@ -99,9 +100,13 @@ class bot(Thread):
 				pass
 			except (xml.parsers.expat.ExpatError, xmpp.protocol.XMLNotWellFormed):
 				self.error('=> Debug: invalid stanza', debug=True)
+				unlock = True
 			except:
 				self.error('[Error] Unkonwn exception on XMPP thread:')
 				traceback.print_exc()
+				unlock = True
+			if unlock == True:
+				c.lock.release()
 	
 	
 	def _xmpp_presence_handler(self, dispatcher, presence):