Charles-François Natali <neolo...@free.fr> added the comment: > The attached patch adds a call to recv in handle_read, updates the > documentation and adds a test case.
In this kind of situation, it is perfectly legitimate for the client to perform a half-duplex close (shutdown(SHUT_WR)), since it does not intend to send data (which is implied by the fact that the sever doesn't implement an handle_read() method). With the current code, the server will keep sending data until the remote end close()s its socket. With this patch, this would break: the server's handle_close() method will be called right away. > There are some cases where it is important to detect that the remote > end is disconnected even if there is no data to send. Indeed, but if you must detect in a timely maner that the remote end close()d its connection, you should provide an handle_read() method. I don't think that breaking perfectly valid code to help hypothetical sloppy applications is a good idea. Here's what the doc says: """ handle_close() | Implied by a read event with no data available [...] handle_close() | Called when the socket is closed. """ Note that "Called when the socket is closed" is confusing: it should probably be rephrased as "Called when the remote endpoint has performed a shutdown", or something along those lines. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13311> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com