Blob Blame History Raw
check error before incoming or outgoing events

https://bugzilla.redhat.com/show_bug.cgi?id=649986
http://trac.gajim.org/ticket/5991

diff -r c47219e5a552 -r ba5c2eb1f1e7 src/common/xmpp/idlequeue.py
--- a/src/common/xmpp/idlequeue.py	Mon Oct 25 20:09:30 2010 +0200
+++ b/src/common/xmpp/idlequeue.py	Mon Oct 25 21:06:45 2010 +0200
@@ -388,20 +388,22 @@
             self.unplug_idle(fd)
             return False
 
+        if flags & IS_CLOSED:
+            # io error, don't expect more events
+            self.remove_timeout(obj.fd)
+            self.unplug_idle(obj.fd)
+            obj.pollend()
+            return False
+
         if flags & PENDING_READ:
             #print 'waiting read on %d, flags are %d' % (fd, flags)
             obj.pollin()
             return True
 
-        elif flags & PENDING_WRITE:
+        if flags & PENDING_WRITE:
             obj.pollout()
             return True
 
-        elif flags & IS_CLOSED:
-            # io error, don't expect more events
-            self.remove_timeout(obj.fd)
-            self.unplug_idle(obj.fd)
-            obj.pollend()
         return False
 
     def process(self):