fixed deadlock in json-rpc mode

* properly unlock mutex to avoid deadlock

see #572
This commit is contained in:
Bernhard B
2024-08-09 23:02:40 +02:00
parent f3289395ae
commit e6ff51e3d8
2 changed files with 4 additions and 3 deletions

View File

@@ -531,10 +531,11 @@ func (a *Api) wsPing(ws *websocket.Conn, stop chan struct{}) {
return
case <-pingTicker.C:
a.wsMutex.Lock()
defer a.wsMutex.Unlock()
if err := ws.WriteMessage(websocket.PingMessage, []byte{}); err != nil {
a.wsMutex.Unlock()
return
}
a.wsMutex.Unlock()
}
}
}