3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

recover from client-caused panics

This commit is contained in:
Shivaram Lingamneni 2017-10-23 18:38:32 -04:00
parent fbaf2d8e3a
commit 054f57e215

View File

@ -184,6 +184,15 @@ func (client *Client) run() {
var line string
var msg ircmsg.IrcMessage
defer func() {
if r := recover(); r != nil {
client.server.logger.Error("internal", fmt.Sprintf("Client caused panic, disconnecting: %v", r))
debug.PrintStack()
}
// ensure client connection gets closed
client.destroy()
}()
client.idletimer = NewIdleTimer(client)
client.idletimer.Start()
@ -225,9 +234,6 @@ func (client *Client) run() {
break
}
}
// ensure client connection gets closed
client.destroy()
}
//