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

François-Xavier Bourlet report at bugs.python.org
Fri Jun 27 23:30:57 CEST 2014


François-Xavier Bourlet added the comment:

No worries, I am glad to see asyncore going away. It was indeed badly
designed in the first place.

--
François-Xavier Bourlet

On Fri, Jun 27, 2014 at 2:28 PM, STINNER Victor <report at bugs.python.org> wrote:
>
> STINNER Victor added the comment:
>
> "Actually the class asyncore.dispatcher_with_send do not handle properly disconnection. When the endpoint shutdown his sending part of the socket, but keep the socket open in reading, the current implementation of dispatcher_with_send will close the socket without sending pending data."
>
> It looks like asyncore doesn't handle this use case.
>
> To me, it doesn't look like a minor issue, but more a design issue. Fixing it requires to change the design of asyncore.
>
> The asyncio module has a better design. It has a write_eof() method to close the write end without touching the read end. For example, for sockets, write_eof() calls sock.shutdown(socket.SHUT_WR). After write_eof(), the read continues in background as any other task. For the read end, the protocol has a eof_received() method to decide if the socket should close, or if it should be kept open for writing (but only for writing).
>
> Giampaolo wrote:
>> I think this thread is becoming a little messy and since asyncore/asynchat are in a situation where even the slightest change can break existent code I recommend to be really careful.
>
> Moreover, the asyncore module has been deprecated in favor of the asyncio module.
>
> I close this issue for all these reasons.
>
> Sorry Xavier for your patches, but it's time to focus our efforts on a single module and asyncio has a much better design to handle such use cases.
>
> ----------
> nosy: +haypo
> resolution:  -> wont fix
> status: open -> closed
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue12498>
> _______________________________________

----------

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


More information about the Python-bugs-list mailing list