fix: prepare dispatcher properly

This commit is contained in:
əlemi 2022-04-18 20:25:52 +02:00
parent d53272e411
commit a29cd737e8
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -196,17 +196,14 @@ class Treepuncher(
async def _work(self): async def _work(self):
try: try:
server_data = await self.info(host=self.host, port=self.port) server_data = await self.info()
self.dispatcher.set_proto(server_data['version']['protocol'])
except Exception: except Exception:
return self.logger.exception("exception while pinging server") return self.logger.exception("exception while pinging server")
while self._processing: while self._processing:
try: try:
await self.join( self.dispatcher.whitelist(self.callback_keys(filter=Packet))
host=self.host, await self.join()
port=self.port,
proto=server_data['version']['protocol'],
packet_whitelist=self.callback_keys(filter=Packet),
)
except ConnectionRefusedError: except ConnectionRefusedError:
self.logger.error("Server rejected connection") self.logger.error("Server rejected connection")
except OSError as e: except OSError as e: