You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now we have some awkward language saying that sometimes we do, sometimes we don't. It's not very helpful, and there's nothing particularly important about preserving an unconnected socket object -- if users really want it they can just create a new one. So we should just close it consistently.
The text was updated successfully, but these errors were encountered:
There was some confusion in chat about whether this had already been done. Which makes sense, because look, here's some code in connect that closes the socket on cancellation:
# We can't really cancel a connect, and the socket is in an
# indeterminate state. Better to close it so we don't get
# confused.
self._sock.close()
raise
However, this only handles a cancellation that occurs during that call to wait_socket_writable. There are other places in the method that a cancellation could happen. So right now, if a cancellation happens in wait_socket_writable, then the socket is closed, but if it happens somewhere else inside connect, the socket isn't closed. That's kind of confusing. The idea in this issue is to make it so that any cancellation inside connect should leave the socket closed. Basically this just means taking the try/except I pasted above, and expanding it so that it wraps around the whole method, not just the call to wait_socket_writable.
(Thanks to @WindSoilder for pointing out the lack of clarity here.)
Right now we have some awkward language saying that sometimes we do, sometimes we don't. It's not very helpful, and there's nothing particularly important about preserving an unconnected socket object -- if users really want it they can just create a new one. So we should just close it consistently.
The text was updated successfully, but these errors were encountered: