conn 정리시 널 체크

This commit is contained in:
2024-02-14 11:08:22 +09:00
parent 16b43ec31d
commit eb3926e575

View File

@ -295,10 +295,20 @@ func (ws *WebsocketHandler) mainLoop(ctx context.Context) {
return room
}
shutdownConn := func(c *wsconn) {
defer func() {
r := recover()
if r != nil {
logger.Println(r)
}
}()
ws.ClientDisconnected(c)
c.Close()
}
defer func() {
for _, conn := range entireConns {
ws.ClientDisconnected(conn)
conn.Close()
shutdownConn(conn)
}
}()