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 neologix
Recipients François-Xavier.Bourlet, neologix, xdegaye
Date 2011-10-30.17:09:41
SpamBayes Score 2.349232e-13
Marked as misclassified No
Message-id <CAH_1eM2nXVLGnepoAVtmU2N2C+1MAt68qetGQHBkvEp1+M5itA@mail.gmail.com>
In-reply-to <1319990394.56.0.309115728448.issue12498@psf.upfronthosting.co.za>
Content
> The attached patch uses another name

In that case, you should use a name starting with an underscore
("private" namespace).

> and drains the output buffer only on a close event, not on error conditions.

Hmmm...
I don't think it's a good idea.
For example, look at this in send():
"""
        except socket.error as why:
            # winsock sometimes throws ENOTCONN
            if why.args[0] in _DISCONNECTED:
                self.handle_close()
                return b''
"""

So it looks like on Windows, ENOTCONN can be returned instead of EOF:
the pending_close_evt flag wouldn't be set, and we wouldn't drain the
output buffer.
Also, some OSes can return POLLHUP without POLLIN when the remote end
shut down the connection:
http://blogs.oracle.com/vlad/entry/poll_and_pollhup_in_solaris
readwrite() would call handle_close() without setting the flag, and
the output buffer would also be lost (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...).
So I'd rather stay on the safe side, and always try to drain the
output buffer in handle_close (worth case, we'll receive a
EPIPE/ECONNRESET, initiate_send will return 0 and we'll break out of
the loop).

> I will do the patch for asynchat and do both test cases, unless you
> beat me to it.

Go ahead :-)
History
Date User Action Args
2011-10-30 17:09:42neologixsetrecipients: + neologix, xdegaye, François-Xavier.Bourlet
2011-10-30 17:09:41neologixlinkissue12498 messages
2011-10-30 17:09:41neologixcreate