From 9c1efcc38b211597b622fc44fd1f466a8a76ec33 Mon Sep 17 00:00:00 2001 From: Suwings Date: Sun, 17 Jul 2022 16:02:45 +0800 Subject: [PATCH] =?UTF-8?q?Feat:=20=E5=AE=8C=E5=96=84=E5=9F=BA=E5=B2=A9?= =?UTF-8?q?=E7=89=88=E5=8D=8F=E8=AE=AE=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entity/minecraft/mc_getplayer_bedrock.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/entity/minecraft/mc_getplayer_bedrock.ts b/src/entity/minecraft/mc_getplayer_bedrock.ts index cdefeee..ee6f918 100644 --- a/src/entity/minecraft/mc_getplayer_bedrock.ts +++ b/src/entity/minecraft/mc_getplayer_bedrock.ts @@ -38,8 +38,10 @@ async function request(ip: string, port: number) { }; return new Promise((r, j) => { client.on("error", (err: any) => { + try { + client.close(); + } catch (error) {} j(err); - client.close(); }); client.on("message", (data: any) => { const result = data.toString().split(";"); @@ -54,7 +56,9 @@ async function request(ip: string, port: number) { }); setTimeout(() => { j("request timeout"); - client.close(); + try { + client.close(); + } catch (error) {} }, 5000); }); }