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 <rep...@bugs.python.org> <http://bugs.python.org/issue12498> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com