small fixes
This commit is contained in:
parent
7b72287215
commit
c6f3d1cacf
1 changed files with 8 additions and 1 deletions
|
@ -59,7 +59,11 @@ class Client:
|
||||||
):
|
):
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.options = options or {}
|
self.options = options or {
|
||||||
|
"reconnect" : True,
|
||||||
|
"rctime" : 5.0,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
self.token = token
|
self.token = token
|
||||||
self.username = username
|
self.username = username
|
||||||
|
@ -171,6 +175,9 @@ class Client:
|
||||||
self._logger.error("Server rejected connection")
|
self._logger.error("Server rejected connection")
|
||||||
except Exception:
|
except Exception:
|
||||||
self._logger.exception("Exception in Client connection")
|
self._logger.exception("Exception in Client connection")
|
||||||
|
if not self.options["reconnect"]:
|
||||||
|
await self.stop(block=False)
|
||||||
|
break
|
||||||
await asyncio.sleep(self.options["rctime"])
|
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
|
def _handshake(self, force:bool=False) -> Tuple[Packet, Packet]: # TODO make this fancier! poll for version and status first
|
||||||
|
|
Loading…
Reference in a new issue