Xavier de Gaye <[email protected]> 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.
>
> Adding this method to the class fix the problem:
>
> def handle_close(self):
> if not self.writable():
> dispatcher.close()
This does not seem to work. The attached Python 3.2 script
'asyncore_12498.py' goes into an infinite loop of calls to
handle_read/handle_close when handle_close is defined as above. In
this script the Writer sends a 4096 bytes message when connected, the
Reader reads only 64 bytes and closes the connection afterwards. Then
follows the sequence:
select() returns a read event handled by handle_read()
handle_read() calls recv()
socket.recv() returns 0 to indicate a closed connection
recv() calls handle_close
This sequence is repeated forever in asyncore.loop() since out_buffer
is never empty.
Note that after the first 'handle_close' has been printed, there are
no 'handle_write' printed, which indicates that the operating system
(here linux) states that the socket is not writable.
----------
nosy: +xdegaye
Added file: http://bugs.python.org/file23547/asyncore_12498.py
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12498>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com