Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.7] bpo-31922: Do not connect UDP sockets when broadcast is allowed (GH-423) #13162

Merged
merged 1 commit into from
May 7, 2019

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 7, 2019

Moved from python/asyncioGH-493.

This PR fixes issue python/asyncioGH-480, as explained in this comment.

The _SelectorDatagramTransport.sendto method has to be modified so _sock.sendto is used in all cases (because it is tricky to reliably tell if the socket is connected or not). Could that be an issue for connected sockets? EDIT ... so _sock.send is used only if _sock is connected.

It also protects socket.getsockname against OSError in _SelectorTransport. This might happen on Windows if the socket is not connected (e.g. for UDP broadcasting).

https://bugs.python.org/issue31922
(cherry picked from commit 63deaa5)

Co-authored-by: Vincent Michel [email protected]

https://bugs.python.org/issue31922

…onGH-423)

*Moved from python/asyncioGH-493.*

This PR fixes issue python/asyncioGH-480, as explained in [this comment](https:/python/asyncio/issues/480GH-issuecomment-278703828).

The `_SelectorDatagramTransport.sendto` method has to be modified ~~so `_sock.sendto` is used in all cases (because it is tricky to reliably tell if the socket is connected or not). Could that be an issue for connected sockets?~~ *EDIT* ... so `_sock.send` is used only if `_sock` is connected.

It also protects `socket.getsockname` against `OSError` in `_SelectorTransport`. This might happen on Windows if the socket is not connected (e.g. for UDP broadcasting).

https://bugs.python.org/issue31922
(cherry picked from commit 63deaa5)

Co-authored-by: Vincent Michel <[email protected]>
@miss-islington
Copy link
Contributor Author

@vxgmichel: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 19ca5b5 into python:3.7 May 7, 2019
@miss-islington miss-islington deleted the backport-63deaa5-3.7 branch May 7, 2019 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants