fix: ws 处理 Panic 协程异常
This commit is contained in:
@@ -100,6 +100,12 @@ func (s *WSImpl) NewClient(uid string, groupIDs []string, conn *websocket.Conn)
|
||||
}
|
||||
}
|
||||
|
||||
defer func() {
|
||||
// 在这里处理 Panic 协程异常
|
||||
if err := recover(); err != nil {
|
||||
logger.Errorf("ws Panic Error: %s => %v", clientID, err)
|
||||
}
|
||||
}()
|
||||
go s.clientRead(wsClient)
|
||||
go s.clientWrite(wsClient)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user