recover client panic

This commit is contained in:
CPunch 2023-03-05 02:32:11 -06:00
parent 115005b6a3
commit 7b60d679e4

View File

@ -53,6 +53,9 @@ func (client *Client) Send(data interface{}, typeID uint32) {
func (client *Client) ClientHandler() { func (client *Client) ClientHandler() {
defer func() { defer func() {
if err := recover(); err != nil {
log.Printf("Client %p panic'd! %v", client, err)
}
client.conn.Close() client.conn.Close()
client.server.unregister <- client client.server.unregister <- client
}() }()