diff --git a/extmod/uasyncio/stream.py b/extmod/uasyncio/stream.py index 395ff1f6af..2a259e618f 100644 --- a/extmod/uasyncio/stream.py +++ b/extmod/uasyncio/stream.py @@ -112,7 +112,6 @@ class Server: s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(ai[-1]) s.listen(backlog) - self.task = core.cur_task # Accept incoming connections while True: try: @@ -135,7 +134,7 @@ class Server: # TODO could use an accept-callback on socket read activity instead of creating a task async def start_server(cb, host, port, backlog=5): s = Server() - core.create_task(s._serve(cb, host, port, backlog)) + s.task = core.create_task(s._serve(cb, host, port, backlog)) return s