chore: add debug log in writePongMsg (#2446)

* update protocol in go mod.

* add debug log in writePongMsg.

* update log level.
This commit is contained in:
Monet Lee
2024-07-26 15:52:37 +08:00
committed by GitHub
parent a8b84911a4
commit c3c9969f2f
3 changed files with 12 additions and 6 deletions
+9 -3
View File
@@ -107,7 +107,6 @@ func (c *Client) pingHandler(appData string) error {
}
log.ZDebug(c.ctx, "ping Handler Success.", "appData", appData)
return c.writePongMsg(appData)
}
@@ -392,17 +391,24 @@ func (c *Client) writePingMsg() error {
}
func (c *Client) writePongMsg(appData string) error {
log.ZDebug(c.ctx, "write Pong Msg in Server", "appData", appData)
if c.closed.Load() {
return nil
}
log.ZDebug(c.ctx, "write Pong Msg in Server", "appData", appData)
c.w.Lock()
defer c.w.Unlock()
log.ZDebug(c.ctx, "write Pong Msg in Server", "appData", appData)
err := c.conn.SetWriteDeadline(writeWait)
if err != nil {
return err
return errs.Wrap(err)
}
err = c.conn.WriteMessage(PongMessage, []byte(appData))
if err != nil {
log.ZWarn(c.ctx, "Write Message have error", errs.Wrap(err), "Pong msg", PongMessage)
}
return c.conn.WriteMessage(PongMessage, []byte(appData))
return errs.Wrap(err)
}