This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients giampaolo.rodola, josiahcarlson, neologix, stutzbach, xdegaye
Date 2011-11-03.17:43:43
SpamBayes Score 9.936496e-15
Marked as misclassified No
Message-id <1320342224.5.0.292555355299.issue13311@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2011-11-03 17:43:44neologixsetrecipients: + neologix, josiahcarlson, giampaolo.rodola, stutzbach, xdegaye
2011-11-03 17:43:44neologixsetmessageid: <1320342224.5.0.292555355299.issue13311@psf.upfronthosting.co.za>
2011-11-03 17:43:43neologixlinkissue13311 messages
2011-11-03 17:43:43neologixcreate