From 7b60d679e425bf64a60e35908d1c32f6dc2892e9 Mon Sep 17 00:00:00 2001 From: CPunch Date: Sun, 5 Mar 2023 02:32:11 -0600 Subject: [PATCH] recover client panic --- server/client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/client.go b/server/client.go index e2b9215..ee11c97 100644 --- a/server/client.go +++ b/server/client.go @@ -53,6 +53,9 @@ func (client *Client) Send(data interface{}, typeID uint32) { func (client *Client) ClientHandler() { defer func() { + if err := recover(); err != nil { + log.Printf("Client %p panic'd! %v", client, err) + } client.conn.Close() client.server.unregister <- client }()