Hi there,

I tried to report this directly to the author of the libevent-baset stackless 
socket, at the e-mail address indicated in the module 
([email protected]), 
but my e-mail bounced. Here's hoping he's following this list. 


I found a little bug in the close method of evsocket, which I thought
you might like to know about. As implemented, you can't close a socket
_unless_ the fileobject is using it when you call close():

   def close(self):
       # XXX Stupid workaround
       # Don't close while the fileobject is still using the fakesocket
       def _close():
           while self.fileobject._sock == self:
               stackless.schedule()
           self._sock.close()
           del sockets[id(self)]
       if self.fileobject:               # <---------
           stackless.tasklet(_close)()
       # So, if not self.fileobject, close() does nothing.

I suggest something like:

   def close(self):
       @tasklet
       def _wait_and_close():
           # XXX Stupid workaround
           while self.fileobject._sock == self:
               stackless.schedule()
           _close_now()
       def _close_now():
           self._sock.close()
           del sockets[id(self)]
       if self.fileobject:
           _wait_and_close()
       else:
           _close_now()

Regards,

Esteban.


_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to