Schedule reconnect asynchronously if ping could not be sent.

This commit is contained in:
Joachim Bauch 2022-08-30 11:46:45 +02:00
parent 4dfffca285
commit cdbc177179
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -488,7 +488,7 @@ func (c *mcuProxyConnection) sendPing() bool {
c.conn.SetWriteDeadline(now.Add(writeWait)) // nolint
if err := c.conn.WriteMessage(websocket.PingMessage, []byte(msg)); err != nil {
log.Printf("Could not send ping to proxy at %s: %v", c, err)
c.scheduleReconnect()
go c.scheduleReconnect()
return false
}