Commit f7cdbbde authored by Him188's avatar Him188 Committed by GitHub

Blocking pass packets to handlers

parent a64123bd
......@@ -124,19 +124,11 @@ internal class TIMBotNetworkHandler(private val bot: Bot) : BotNetworkHandler {
if (ServerPacketReceivedEvent(bot, packet).broadcast().cancelled) {
return
}
withContext(CoroutineExceptionHandler { _, e -> e.printStackTrace() }) {
launch(this.coroutineContext) {
loginHandler.onPacketReceived(packet)
}
packetHandlers.forEach {
launch(this.coroutineContext) {
it.instance.onPacketReceived(packet)
}
}
}//awaits all coroutines launched in this block
loginHandler.onPacketReceived(packet)
packetHandlers.forEach {
it.instance.onPacketReceived(packet)
}
}
private var socket: DatagramSocket? = null
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment