handle read event before close event in case pipe sends us something and close pipe in the same time.
This commit is contained in:
		
							parent
							
								
									359a6e901e
								
							
						
					
					
						commit
						1bbb42a9ae
					
				
					 1 changed files with 11 additions and 8 deletions
				
			
		|  | @ -388,6 +388,16 @@ class IdleQueue: | ||||||
|             self.unplug_idle(fd) |             self.unplug_idle(fd) | ||||||
|             return False |             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: |         if flags & IS_CLOSED: | ||||||
|             # io error, don't expect more events |             # io error, don't expect more events | ||||||
|             self.remove_timeout(obj.fd) |             self.remove_timeout(obj.fd) | ||||||
|  | @ -395,15 +405,8 @@ class IdleQueue: | ||||||
|             obj.pollend() |             obj.pollend() | ||||||
|             return False |             return False | ||||||
| 
 | 
 | ||||||
|         if flags & PENDING_READ: |         if read_write: | ||||||
|             #print 'waiting read on %d, flags are %d' % (fd, flags) |  | ||||||
|             obj.pollin() |  | ||||||
|             return True |             return True | ||||||
| 
 |  | ||||||
|         if flags & PENDING_WRITE: |  | ||||||
|             obj.pollout() |  | ||||||
|             return True |  | ||||||
| 
 |  | ||||||
|         return False |         return False | ||||||
| 
 | 
 | ||||||
|     def process(self): |     def process(self): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue