Skip to content

Commit

Permalink
Fixed #443 by adding the registrar & timeout kwargs to connect_by_ser…
Browse files Browse the repository at this point in the history
…vice and allowing them to be passed to discover---this allows users to connect by service with a non-default registrar or change the default timeout
  • Loading branch information
comrumino committed Apr 18, 2021
1 parent 7634a7b commit b18987e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rpyc/utils/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def discover(service_name, host=None, registrar=None, timeout=2):
return addrs


def connect_by_service(service_name, host=None, service=VoidService, config={}):
def connect_by_service(service_name, host=None, registrar=None, timeout=2, service=VoidService, config={}):
"""create a connection to an arbitrary server that exposes the requested service
:param service_name: the service to discover
Expand All @@ -240,7 +240,7 @@ def connect_by_service(service_name, host=None, service=VoidService, config={}):
# some of which could be dead. We iterate over the list returned and return the first
# one we could connect to. If none of the registered servers is responsive we re-throw
# the exception
addrs = discover(service_name, host=host)
addrs = discover(service_name, host=host, registrar=registar, timeout=timeout)
for host, port in addrs:
try:
return connect(host, port, service, config=config)
Expand Down

0 comments on commit b18987e

Please sign in to comment.