QUERY · ISSUE
extmod/uasyncio: add serve_forever()?
extmod
Official example from python documentation:
async def main():
# Get a reference to the event loop as we plan to use
# low-level APIs.
loop = asyncio.get_running_loop()
server = await loop.create_server(
lambda: EchoServerProtocol(),
'127.0.0.1', 8888)
async with server:
await server.serve_forever()
asyncio.run(main())
Micropython's Server class already has support for async with, but lacks convenient method serve_forever.
Do you think it is make sense to add it?
CANDIDATE · PULL REQUEST
extmod/uasyncio: Fix start_server and wait_closed race condition
extmod
This fix prevents server.wait_closed() from raising an AttributeError
when trying to access server.task. This can happen if it is called
immediately after start_server().