Charles-François Natali <neolo...@free.fr> added the comment:

> 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.

Yes, that's the problem it noticed in 
http://bugs.python.org/issue12498#msg146645 :
"""
(Note that the current code is probably broken: when POLLHUP is
received, this likely means that the remote end has shutdown the
connection, but there might still be some data in the input socket
buffer. I'll try to dig a little...).
"""

I think the best would be to not handle POLLHUP events while POLLIN is set, so 
that the handlers can have a chance to drain the input socket buffer.
But it's a separate issue, could you create a new one?
You may also add a patch (in the same issue) to remove the useless setting of 
input flags to poll():
"""
        if flags:
            # Only check for exceptions if object was either readable
            # or writable.
            flags |= select.POLLERR | select.POLLHUP | select.POLLNVAL
            pollster.register(fd, flags)
"""

POLLERR, POLLHUP and POLLNVAL don't make sense when passed as input to poll() 
(they're set automatically in the output revents).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12498>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to