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 xdegaye
Recipients François-Xavier.Bourlet, neologix, xdegaye
Date 2011-10-29.19:32:12
SpamBayes Score 1.9417307e-06
Marked as misclassified No
Message-id <1319916733.54.0.962280734185.issue12498@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2011-10-29 19:32:13xdegayesetrecipients: + xdegaye, neologix, François-Xavier.Bourlet
2011-10-29 19:32:13xdegayesetmessageid: <1319916733.54.0.962280734185.issue12498@psf.upfronthosting.co.za>
2011-10-29 19:32:12xdegayelinkissue12498 messages
2011-10-29 19:32:12xdegayecreate