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-11-03.16:43:42
SpamBayes Score 3.896905e-11
Marked as misclassified No
Message-id <1320338624.8.0.572127607844.issue12498@psf.upfronthosting.co.za>
In-reply-to
Content
Attached is a new patch following the code review.

After rewriting the asyncore test to check that the data has been
successfully received by the client, the test fails when
using poll() and a data size of 4096 bytes. The reason is that when
TestHandler closes the connection after writing the output buffer, the
client receives a POLLHUP which prevents it to receive the data since
POLLHUP is triggering a call to handle_close.

POSIX states:
"""
POLLHUP
    A device has been disconnected, or a pipe or FIFO has been closed
    by the last process that had it open for writing. Once set, the
    hangup state of a FIFO shall persist until some process opens the
    FIFO for writing or until all read-only file descriptors for the
    FIFO are closed. This event and POLLOUT are mutually-exclusive; a
    stream can never be writable if a hangup has occurred. However,
    this event and POLLIN, POLLRDNORM, POLLRDBAND, or POLLPRI are not
    mutually-exclusive. This flag is only valid in the revents
    bitmask; it shall be ignored in the events member.
"""

The attached patch changes the handling of POLLHUP to fix this: it
calls a new method named handle_hangup_evt() on a POLLHUP event, and
uses a new _hangup attribute to have writable() return False after a
POLLHUP. Note that we do get a close event (on linux) when all data
has been received, allowing the client to close the socket.

Please review this new patch.
History
Date User Action Args
2011-11-03 16:43:45xdegayesetrecipients: + xdegaye, neologix, François-Xavier.Bourlet
2011-11-03 16:43:44xdegayesetmessageid: <1320338624.8.0.572127607844.issue12498@psf.upfronthosting.co.za>
2011-11-03 16:43:44xdegayelinkissue12498 messages
2011-11-03 16:43:44xdegayecreate