fix: prepare dispatcher properly
This commit is contained in:
parent
d53272e411
commit
a29cd737e8
1 changed files with 4 additions and 7 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue