Skip to content

Commit

Permalink
Merge b111b5d into b3a34dd
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleech committed Jun 22, 2021
2 parents b3a34dd + b111b5d commit 4b5fe45
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion extmod/uasyncio/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ async def _serve(self, cb, host, port, backlog):
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(ai[-1])
s.listen(backlog)
self.task = core.create_task(self._listen(cb, s))

async def _listen(self, cb, s):
# Accept incoming connections
while True:
try:
Expand All @@ -138,7 +141,7 @@ async def _serve(self, cb, host, port, backlog):
# 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()
s.task = core.create_task(s._serve(cb, host, port, backlog))
await s._serve(cb, host, port, backlog)
return s


Expand Down

0 comments on commit 4b5fe45

Please sign in to comment.