174a3c4
check error before incoming or outgoing events
174a3c4
174a3c4
https://bugzilla.redhat.com/show_bug.cgi?id=649986
174a3c4
http://trac.gajim.org/ticket/5991
174a3c4
174a3c4
diff -r c47219e5a552 -r ba5c2eb1f1e7 src/common/xmpp/idlequeue.py
174a3c4
--- a/src/common/xmpp/idlequeue.py	Mon Oct 25 20:09:30 2010 +0200
174a3c4
+++ b/src/common/xmpp/idlequeue.py	Mon Oct 25 21:06:45 2010 +0200
174a3c4
@@ -388,20 +388,22 @@
174a3c4
             self.unplug_idle(fd)
174a3c4
             return False
174a3c4
 
174a3c4
+        if flags & IS_CLOSED:
174a3c4
+            # io error, don't expect more events
174a3c4
+            self.remove_timeout(obj.fd)
174a3c4
+            self.unplug_idle(obj.fd)
174a3c4
+            obj.pollend()
174a3c4
+            return False
174a3c4
+
174a3c4
         if flags & PENDING_READ:
174a3c4
             #print 'waiting read on %d, flags are %d' % (fd, flags)
174a3c4
             obj.pollin()
174a3c4
             return True
174a3c4
 
174a3c4
-        elif flags & PENDING_WRITE:
174a3c4
+        if flags & PENDING_WRITE:
174a3c4
             obj.pollout()
174a3c4
             return True
174a3c4
 
174a3c4
-        elif flags & IS_CLOSED:
174a3c4
-            # io error, don't expect more events
174a3c4
-            self.remove_timeout(obj.fd)
174a3c4
-            self.unplug_idle(obj.fd)
174a3c4
-            obj.pollend()
174a3c4
         return False
174a3c4
 
174a3c4
     def process(self):