handle read event before close event in case pipe sends us something and close pipe in the same time.
fixes a regression caused by gajim-0.14-check-error.patch
(Peter could not connect to gmail.com, reported in
https://admin.fedoraproject.org/updates/gajim-0.14.1-2.fc14)
# HG changeset patch
# User Yann Leboulanger <asterix@lagaule.org>
# Date 1288345298 -7200
# Node ID 50980325f73d04f447f679834f4e88cf6806954a
# Parent 56dcfc87d01e39cbcd30eba453e3e9d8efcaed17
diff -r 56dcfc87d01e -r 50980325f73d src/common/xmpp/idlequeue.py
--- a/src/common/xmpp/idlequeue.py Fri Oct 29 11:37:07 2010 +0200
+++ b/src/common/xmpp/idlequeue.py Fri Oct 29 11:41:38 2010 +0200
@@ -388,6 +388,16 @@
self.unplug_idle(fd)
return False
+ read_write = False
+ if flags & PENDING_READ:
+ #print 'waiting read on %d, flags are %d' % (fd, flags)
+ obj.pollin()
+ read_write = True
+
+ elif flags & PENDING_WRITE and not flags & IS_CLOSED:
+ obj.pollout()
+ read_write = True
+
if flags & IS_CLOSED:
# io error, don't expect more events
self.remove_timeout(obj.fd)
@@ -395,15 +405,8 @@
obj.pollend()
return False
- if flags & PENDING_READ:
- #print 'waiting read on %d, flags are %d' % (fd, flags)
- obj.pollin()
+ if read_write:
return True
-
- if flags & PENDING_WRITE:
- obj.pollout()
- return True
-
return False
def process(self):