New submission from Teodor Georgiev <lv_tok...@yahoo.com>:

Python 2.7.1
I am trying to add a simple timer to each created socket and destroy it
once the timer expires:

class client(asyncore.dispatcher):
    def __init__(self,host):
    ...
    self.timeout = time.time() + 5

    def readable(self):
        if time.time() >= self.timeout:
            self.close()
        return True

When running that code, it raises an exception:

 asyncore.loop(timeout=0.8)
  File "/usr/lib/python2.6/asyncore.py", line 211, in loop
    poll_fun(timeout)
  File "/usr/lib/python2.6/asyncore.py", line 144, in poll
    raise
  File "/usr/lib/python2.6/asyncore.py", line 141, in poll
    r, w, e = select.select(r, w, e, timeout)
select.error: (9, 'Bad file descriptor')


Although del_channel is executed properly and the socket is removed from the 
map, the poll function is not updated with that info and continues to keep the 
socket into the r,w,e.

----------
assignedto: giampaolo.rodola
messages: 1895
nosy: giampaolo.rodola, tgeorgiev
priority: bug
status: unread
title: asyncore does not react properly on close()

_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue371>
_______________________________________________________
_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
http://mail.python.org/mailman/listinfo/tracker-discuss

Reply via email to