From 6eb10b566e5714aea0ee6b1b2cff7eba29549ae8 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 2 Nov 2023 18:39:42 +0100 Subject: [PATCH] Added IPC retry --- sbapp/sideband/core.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index d0968d3..73a731a 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -1169,15 +1169,22 @@ class SidebandCore(): self.state_db[prop] = val return True else: - try: + def set(): if self.rpc_connection == None: self.rpc_connection = multiprocessing.connection.Client(self.rpc_addr, authkey=self.rpc_key) self.rpc_connection.send({"setstate": (prop, val)}) response = self.rpc_connection.recv() return response + + try: + set() except Exception as e: - RNS.log("Error while setting state over RPC: "+str(e), RNS.LOG_DEBUG) - return False + RNS.log("Error while setting state over RPC: "+str(e)+". Retrying once.", RNS.LOG_DEBUG) + try: + set() + except Exception as e: + RNS.log("Error on retry as well: "+str(e)+". Giving up.", RNS.LOG_DEBUG) + return False def service_set_latest_telemetry(self, latest_telemetry, latest_packed_telemetry): if not RNS.vendor.platformutils.is_android():