circuitpython/extmod/uasyncio
Damien George 7ec95c2768 extmod/uasyncio: Get addr and bind server socket before creating task.
Currently when using uasyncio.start_server() the socket configuration is
done inside a uasyncio.create_task() background function.  If the address
and port are already in use however this throws an OSError which cannot be
cleanly caught behind the create_task().

This commit moves the getaddrinfo and socket binding to the start_server()
function, and only creates the task if that succeeds.  This means that any
OSError from the initial socket configuration is propagated directly up the
call stack, compatible with CPython behaviour.

See #7444.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-26 22:30:22 +10:00
..
__init__.py extmod/uasyncio: Add ThreadSafeFlag. 2021-02-16 16:35:37 +11:00
core.py extmod/uasyncio: Fix race with cancelled task waiting on finished task. 2021-06-16 13:02:37 +10:00
event.py extmod/uasyncio: Add ThreadSafeFlag. 2021-02-16 16:35:37 +11:00
funcs.py extmod/uasyncio: Fix cancellation handling of wait_for. 2020-12-02 12:31:37 +11:00
lock.py extmod/uasyncio: Add error message to Lock.release's RuntimeError. 2020-04-02 00:40:23 +11:00
manifest.py extmod/uasyncio: Add manifest.py for freezing uasyncio Py files. 2020-03-26 01:25:45 +11:00
stream.py extmod/uasyncio: Get addr and bind server socket before creating task. 2021-06-26 22:30:22 +10:00
task.py extmod/uasyncio: Fix race with cancelled task waiting on finished task. 2021-06-16 13:02:37 +10:00