From f7cdbbde2dbf844f3f4eb7b4cf5c460494abed29 Mon Sep 17 00:00:00 2001
From: Him188 <Him188@mamoe.net>
Date: Wed, 9 Oct 2019 23:53:42 +0800
Subject: [PATCH] Blocking pass packets to handlers

---
 .../protocol/tim/TIMBotNetworkHandler.kt       | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt
index 4f2fb799b..4f8e24f12 100644
--- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt
+++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt
@@ -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