From 5ca115a3441eef0c98f1e3bd2088444104947c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Pierre?= Date: Tue, 10 Sep 2024 11:28:06 +1200 Subject: [PATCH] [Update] server: condition in accept loop --- src/py/extra/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/py/extra/server.py b/src/py/extra/server.py index 687ac42..b05b6b7 100644 --- a/src/py/extra/server.py +++ b/src/py/extra/server.py @@ -304,6 +304,8 @@ async def Serve( # TODO: Add condition try: while True: + if options.condition and not options.condition(): + break try: client, _ = await loop.sock_accept(server) # NOTE: Should do something with the tasks