From c6f3d1cacfe19c5864229b63f213d1e5b19e2dc0 Mon Sep 17 00:00:00 2001 From: alemidev Date: Thu, 11 Nov 2021 14:28:56 +0100 Subject: [PATCH] small fixes --- aiocraft/client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/aiocraft/client.py b/aiocraft/client.py index 70c43d6..ed11574 100644 --- a/aiocraft/client.py +++ b/aiocraft/client.py @@ -59,7 +59,11 @@ class Client: ): self.host = host self.port = port - self.options = options or {} + self.options = options or { + "reconnect" : True, + "rctime" : 5.0, + + } self.token = token self.username = username @@ -171,6 +175,9 @@ class Client: self._logger.error("Server rejected connection") except Exception: self._logger.exception("Exception in Client connection") + if not self.options["reconnect"]: + await self.stop(block=False) + break await asyncio.sleep(self.options["rctime"]) def _handshake(self, force:bool=False) -> Tuple[Packet, Packet]: # TODO make this fancier! poll for version and status first