[issue13311] asyncore handle_read should call recv

Xavier de Gaye report at bugs.python.org
Tue Nov 1 17:08:30 CET 2011


New submission from Xavier de Gaye <xdegaye at gmail.com>:

When the remote end disconnects, handle_close is only called if recv
is called (from handle_read). The default implementation of
handle_read does not call recv.

Not having the default implementation of handle_read call recv, has
the following drawbacks:

    an implementation of a subclass of dispatcher that only sends
    data, a logger for example, may believe that it does not have to
    implement handle_read since it does not expect any data and since
    there is no hint in the code or in the documentation that it
    should

    test_handle_expt currently succeeds when it should fail since the
    current handling of out-of-band data is broken (see issue 13310),
    but if the default implementation of handle_read had called recv,
    then test_handle_expt would have failed, allowing to detect the
    problem

The attached patch adds a call to recv in handle_read, updates the
documentation and adds a test case.

Note that when this patch is applied, test_handle_expt fails
as expected, issue 13310 should be fixed first.

----------
components: Library (Lib)
files: handle_read.diff
keywords: patch
messages: 146785
nosy: xdegaye
priority: normal
severity: normal
status: open
title: asyncore handle_read should call recv
type: behavior
versions: Python 2.7, Python 3.3
Added file: http://bugs.python.org/file23581/handle_read.diff

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


More information about the Python-bugs-list mailing list