[issue12498] asyncore.dispatcher_with_send, disconnection problem + miss-conception

Charles-François Natali report at bugs.python.org
Sun Oct 30 19:43:24 CET 2011


Charles-François Natali <neologix at free.fr> added the comment:

> While writing the test case, I found out that the test case does not
> fail before the patch. It seems that draining the output buffer
> already works:
>
> The attached script 'asyncore_shutdown.py' drains the output buffer
> when run without the patch, with Python 3.2, and prints 'Done.'. The
> dispatcher_with_send handle_close() method is never called.

That's because you didn't define a handle_read() method: since you
never read from the socket, you don't detect EOF, and never call
handle_close():

Try with this:
"""
             print('Done.')
             self.close()

+    def handle_read(self):
+        self.recv(MSG_SIZE)
+
     def handle_close(self):
         print('calling handle_close')
         asyncore.dispatcher_with_send.handle_close(self)
"""

And it'll fail ;-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12498>
_______________________________________


More information about the Python-bugs-list mailing list