This also adds CancelledError exception and makes TimeoutError be a
subclass of it. As well as adds default exception handler for it in
the eventloop (which just skips re-adding this coro to the scheduling
queue, as expected).
This module implements "Sans I/O" approach, where packets are created/
parsed using BytesIO objects, and all networking happens outside the
module.
The module implements enough functionality to resolve a domain name
into IP address, for both IPv4 and IPv6.
Other DNS functionality is outside the scope of this module, that's
why it's called *u*dnspkt.
The API is experimental and subject to change.
This module requires .readbin()/.writebin() methods on a stream.
Don't have any wrapper classes for UDP socket, instead just have top-level
coroutines, taking raw socket as an argument:
s.recv(1500) => await uasyncio.udp.recv(s, 1500)
Coros which are passed to .add_reader()/.add_writer() are marked as
I/O-bound using .pend_throw(False). Before scheduling it for normal
execution again, we need to unmark it with .pend_throw(None).
Coros which removed from normal scheduling queue (and possibly put into
another queue, like I/O queue here) are marked with .pend_throw(False).
If wait_for() cancels such a coro, it is explicitly scheduled for execution,
so they actually could process pending exception (coro's exception handler
should take care of removing it from another queue and related clean up).
Unlike optimize_upip, which instantiates a separate distutils/setuptools
command to run after "sdist", sdist_upip overrides "sdist" implementation,
so it simplifies publishing workflow (no need to run adhoc commands).
Besides what optimize_upip did (post-porocessing to remove superfluous
files and recompressing with gzip 4K dictionary), sdist_upip also
adds pre-processing step of generation resource module (R.py) from
resource files.
So, now there's a single (and standard) command to generate a distrubution
package for MicroPython.
It performs handshake in blocking manner, hopes that writes
work without short writes, and hopes that non-blocking read
is implemented properly by ussl module (there're known issues
with axTLS module for example).
Currently executed task is a top-level coroutine scheduled in the event
loop (note that sub-coroutines aren't scheduled in the event loop and
are executed implicitly by yield from/await, driven by top-level coro).
API is not stable and will guaranteedly change, likely completely.
Currently, this tries to folow the same idea as TCP open_connection()
call, but that doesn't make much sense, so that will likely change.