handle read event before close event in case pipe sends us something and close pipe in the same time.

This commit is contained in:
Yann Leboulanger 2010-10-29 11:41:38 +02:00
parent 359a6e901e
commit 1bbb42a9ae
1 changed files with 11 additions and 8 deletions

View File

@ -388,6 +388,16 @@ class IdleQueue:
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 @@ class IdleQueue:
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):