From 744dcd1cb886b38cfb070268a61ef8a999472553 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 2 Aug 2023 15:17:32 +0800 Subject: [PATCH] =?UTF-8?q?bug=20fix:=20=E6=8D=95=E8=8E=B7panic=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E7=A8=8B=E5=BA=8F=E5=81=9C=E6=AD=A2=E8=BF=90?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/app/app.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/app/app.go b/client/app/app.go index 729c454..0794762 100644 --- a/client/app/app.go +++ b/client/app/app.go @@ -58,7 +58,7 @@ func (a *App) Start() { defer func() { a.close(conn, readTicker, latencyTicker) // if not interrupt,restart the client - if !isInterrupt { + if r := recover(); r != nil || !isInterrupt { time.Sleep(5 * time.Second) a.Start() } @@ -112,6 +112,12 @@ func (a *App) Start() { } func (a *App) readLoop(conn *connutil.ConnWrapper) { + defer func() { + if r := recover(); r != nil { + return + } + }() + for { blob := json.RawMessage{} if err := conn.ReadJSON(&blob); err != nil {