remove fd from selector and timeouts

when pollend event is raised
This commit is contained in:
Dimitur Kirov 2006-02-11 21:27:44 +00:00
parent 7e20d89ff2
commit 79d39ac119
1 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,8 @@ class IdleQueue:
del(self.alarms[alarm_time]) del(self.alarms[alarm_time])
def plug_idle(self, obj, writable = True, readable = True): def plug_idle(self, obj, writable = True, readable = True):
if obj.fd == -1:
return
if self.queue.has_key(obj.fd): if self.queue.has_key(obj.fd):
self.unplug_idle(obj.fd) self.unplug_idle(obj.fd)
self.queue[obj.fd] = obj self.queue[obj.fd] = obj
@ -133,6 +135,9 @@ class IdleQueue:
return True return True
elif flags & 16: # closed channel elif flags & 16: # closed channel
# io error, don't expect more events
self.remove_timeout(obj.fd)
self.unplug_idle(obj.fd)
obj.pollend() obj.pollend()
return False return False