From 1b3603d8bf19c7f99128244e5b9ee705e8287a06 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 12 Feb 2015 00:50:48 +0800 Subject: [PATCH] pc_rpc/BestEffortClient: add docstrings --- artiq/protocols/pc_rpc.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/artiq/protocols/pc_rpc.py b/artiq/protocols/pc_rpc.py index 6499ff65b..8de2a3615 100644 --- a/artiq/protocols/pc_rpc.py +++ b/artiq/protocols/pc_rpc.py @@ -250,6 +250,18 @@ class AsyncioClient: class BestEffortClient: + """This class is similar to :class:`artiq.protocols.pc_rpc.Client`, but + network errors are suppressed and connections are retried in the + background. + + RPC calls that failed because of network errors return ``None``. + + :param firstcon_timeout: Timeout to use during the first (blocking) + connection attempt at object initialization. + :param retry: Amount of time to wait between retries when reconnecting + in the background. + + """ def __init__(self, host, port, target_name, firstcon_timeout=0.5, retry=5.0): self.__host = host @@ -306,6 +318,11 @@ class BestEffortClient: self.__conretry_thread = None def close_rpc(self): + """Closes the connection to the RPC server. + + No further method calls should be done after this method is called. + + """ if self.__conretry_thread is None: if self.__socket is not None: self.__socket.close() @@ -341,6 +358,7 @@ class BestEffortClient: "in the background", self.__host, self.__port, self.__target_name) self.__start_conretry() + return None else: if obj["status"] == "ok": return obj["ret"]