mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-25 15:06:17 +01:00
hub: add guard to WSConn.Ping to ensure no nil conn ptr
This commit is contained in:
@@ -111,6 +111,9 @@ func (ws *WsConn) Close(msg []byte) {
|
||||
|
||||
// Ping sends a ping frame to keep the connection alive.
|
||||
func (ws *WsConn) Ping() error {
|
||||
if ws.conn == nil {
|
||||
return gws.ErrConnClosed
|
||||
}
|
||||
ws.conn.SetDeadline(time.Now().Add(deadline))
|
||||
return ws.conn.WritePing(nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user