]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
If a message handler returned None, do not yield it to the caller.
authorBob Halley <halley@dnspython.org>
Sat, 1 May 2021 21:19:16 +0000 (14:19 -0700)
committerBob Halley <halley@dnspython.org>
Sat, 1 May 2021 21:19:16 +0000 (14:19 -0700)
This is a bit cleaner than yielding it and having the caller throw an
exception trying to treat it as a message.

tests/nanonameserver.py

index 18ba6c5594dfd4f79ae94e62113002522c1b6962..5c9a9c7e33e0d7655ae2fbfce26f4a4fffb771c0 100644 (file)
@@ -237,7 +237,7 @@ class Server(threading.Thread):
                 out = thing.to_wire(self.origin, multi=multi, tsig_ctx=tsig_ctx)
                 tsig_ctx = thing.tsig_ctx
                 yield out
-            else:
+            elif thing is not None:
                 yield thing
 
     async def serve_udp(self):