except registered callbacks individually
This commit is contained in:
parent
9327b77c3c
commit
1cd94a899a
1 changed files with 13 additions and 7 deletions
|
@ -209,13 +209,19 @@ class Client:
|
||||||
elif self.dispatcher.state == ConnectionState.PLAY:
|
elif self.dispatcher.state == ConnectionState.PLAY:
|
||||||
await self.play_logic(packet)
|
await self.play_logic(packet)
|
||||||
|
|
||||||
if self.dispatcher.state in self._packet_callbacks:
|
if self.dispatcher.state in self._packet_callbacks:
|
||||||
if Packet in self._packet_callbacks[self.dispatcher.state]: # callback for any packet
|
if Packet in self._packet_callbacks[self.dispatcher.state]: # callback for any packet
|
||||||
for cb in self._packet_callbacks[self.dispatcher.state][Packet]:
|
for cb in self._packet_callbacks[self.dispatcher.state][Packet]:
|
||||||
await cb(packet)
|
try:
|
||||||
if packet.__class__ in self._packet_callbacks[self.dispatcher.state]: # callback for this packet
|
await cb(packet)
|
||||||
for cb in self._packet_callbacks[self.dispatcher.state][packet.__class__]:
|
except Exception as e:
|
||||||
await cb(packet)
|
self._logger.exception("Exception while handling callback")
|
||||||
|
if packet.__class__ in self._packet_callbacks[self.dispatcher.state]: # callback for this packet
|
||||||
|
for cb in self._packet_callbacks[self.dispatcher.state][packet.__class__]:
|
||||||
|
try:
|
||||||
|
await cb(packet)
|
||||||
|
except Exception as e:
|
||||||
|
self._logger.exception("Exception while handling callback")
|
||||||
|
|
||||||
self.dispatcher.incoming.task_done()
|
self.dispatcher.incoming.task_done()
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
|
|
Loading…
Reference in a new issue