From 03441161b2ad7a6027b5d3ec5e4a8c2a1afafa0b Mon Sep 17 00:00:00 2001 From: Josiah Baldwin Date: Tue, 10 Dec 2024 10:31:52 -0800 Subject: [PATCH] Added timeout to check_socket decorator in case a connection fails to be made --- src/meshctrl/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/meshctrl/util.py b/src/meshctrl/util.py index 5d6f772..dfb35b5 100644 --- a/src/meshctrl/util.py +++ b/src/meshctrl/util.py @@ -139,7 +139,7 @@ def compare_dict(dict1, dict2): def _check_socket(f): @functools.wraps(f) async def wrapper(self, *args, **kwargs): - await self.initialized.wait() + await asyncio.wait_for(self.initialized.wait(), 10) if not self.alive and self._main_loop_error is not None: raise self._main_loop_error elif not self.alive: @@ -153,3 +153,6 @@ def _process_websocket_exception(exc): if isinstance(exc, (ssl.SSLCertVerificationError, TimeoutError)): return exc return tmp + +class Proxy(object): + pass \ No newline at end of file