Skip to content

Commit 5cee693

Browse files
authored
Merge pull request #113 from Daniel-Chin/master
relay a `loopCondition` from `start_ns_loop()` to its daemon
2 parents 2750a3a + d856075 commit 5cee693

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Pyro5/nameserver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,8 @@ def __exit__(self, exc_type, exc_value, traceback):
645645

646646

647647
def start_ns_loop(host=None, port=None, enableBroadcast=True, bchost=None, bcport=None,
648-
unixsocket=None, nathost=None, natport=None, storage=None):
648+
unixsocket=None, nathost=None, natport=None, storage=None,
649+
loopCondition=lambda: True):
649650
"""utility function that starts a new Name server and enters its requestloop."""
650651
daemon = NameServerDaemon(host, port, unixsocket, nathost=nathost, natport=natport, storage=storage)
651652
nsUri = daemon.uriFor(daemon.nameserver)
@@ -681,7 +682,7 @@ def start_ns_loop(host=None, port=None, enableBroadcast=True, bchost=None, bcpor
681682
print("URI = %s" % nsUri)
682683
sys.stdout.flush()
683684
try:
684-
daemon.requestLoop()
685+
daemon.requestLoop(loopCondition=loopCondition)
685686
finally:
686687
daemon.close()
687688
if bcserver is not None:

0 commit comments

Comments
 (0)