Message146946
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. |
|
Date |
User |
Action |
Args |
2011-11-03 16:43:45 | xdegaye | set | recipients:
+ xdegaye, neologix, François-Xavier.Bourlet |
2011-11-03 16:43:44 | xdegaye | set | messageid: <1320338624.8.0.572127607844.issue12498@psf.upfronthosting.co.za> |
2011-11-03 16:43:44 | xdegaye | link | issue12498 messages |
2011-11-03 16:43:44 | xdegaye | create | |
|