cpython/Lib/asyncio
Vincent Michel 63deaa5b70 bpo-31922: Do not connect UDP sockets when broadcast is allowed (GH-423)
*Moved from python/asyncio#493.*

This PR fixes issue python/asyncio#480, as explained in [this comment](https://github.com/python/asyncio/issues/480#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
2019-05-07 10:18:49 -07:00
..
__init__.py bpo-34622: Extract asyncio exceptions into a separate module (GH-9141) 2018-09-11 10:13:04 -07:00
base_events.py bpo-31922: Do not connect UDP sockets when broadcast is allowed (GH-423) 2019-05-07 10:18:49 -07:00
base_futures.py bpo-34622: Extract asyncio exceptions into a separate module (GH-9141) 2018-09-11 10:13:04 -07:00
base_subprocess.py asyncio: __del__() keep reference to warnings.warn (GH-11491) 2019-01-10 11:24:40 +01:00
base_tasks.py bpo-34270: Make it possible to name asyncio tasks (GH-8547) 2018-08-08 17:06:47 -04:00
constants.py bpo-33734: asyncio/ssl: a bunch of bugfixes (#7321) 2018-06-04 11:32:35 -04:00
coroutines.py bpo-33672: Fix Task.__repr__ crash with Cython's bogus coroutines (GH-7161) 2018-05-28 16:27:34 -04:00
events.py bpo-33530: Implement Happy Eyeballs in asyncio, v2 (GH-7237) 2019-05-05 04:14:35 -07:00
exceptions.py bpo-34622: Extract asyncio exceptions into a separate module (GH-9141) 2018-09-11 10:13:04 -07:00
format_helpers.py bpo-33672: Fix Task.__repr__ crash with Cython's bogus coroutines (GH-7161) 2018-05-28 16:27:34 -04:00
futures.py bpo-34622: Extract asyncio exceptions into a separate module (GH-9141) 2018-09-11 10:13:04 -07:00
locks.py bpo-34622: Extract asyncio exceptions into a separate module (GH-9141) 2018-09-11 10:13:04 -07:00
log.py
proactor_events.py bpo-23846: Fix ProactorEventLoop._write_to_self() (GH-11566) 2019-01-15 13:58:38 +01:00
protocols.py bpo-35394: Add empty slots to abstract asyncio protocols (#10889) 2018-12-11 19:07:05 +02:00
queues.py bpo-32574: Fix leaks in asyncio.Queue.put() and .get() (#5208) 2018-01-25 18:45:43 -05:00
runners.py bpo-32610: Fix asyncio.all_tasks() to return only pending tasks. (GH-7174) 2018-05-28 17:54:02 -04:00
selector_events.py bpo-31922: Do not connect UDP sockets when broadcast is allowed (GH-423) 2019-05-07 10:18:49 -07:00
sslproto.py bpo-34745: Fix asyncio sslproto memory issues (GH-12386) 2019-03-17 18:51:10 -04:00
staggered.py bpo-33530: Implement Happy Eyeballs in asyncio, v2 (GH-7237) 2019-05-05 04:14:35 -07:00
streams.py Forbid creating of stream objects outside of asyncio (#13101) 2019-05-06 22:52:11 -04:00
subprocess.py Forbid creating of stream objects outside of asyncio (#13101) 2019-05-06 22:52:11 -04:00
tasks.py bpo-24638: Improve the error message in asyncio.ensure_future() (#12848) 2019-05-03 11:35:25 -04:00
transports.py bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914) 2017-12-18 17:03:23 -05:00
unix_events.py asyncio: __del__() keep reference to warnings.warn (GH-11491) 2019-01-10 11:24:40 +01:00
windows_events.py bpo-11555: Enhance IocpProactor.close() log again (GH-11563) 2019-01-15 12:13:48 +01:00
windows_utils.py asyncio: __del__() keep reference to warnings.warn (GH-11491) 2019-01-10 11:24:40 +01:00