mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-23 19:52:41 +01:00
Fix spinning for loop
This commit is contained in:
parent
4ed66ce20e
commit
0f530e7902
@ -185,7 +185,6 @@ func (m *MMClient) Logout() error {
|
|||||||
m.WsQuit = true
|
m.WsQuit = true
|
||||||
m.WsClient.Close()
|
m.WsClient.Close()
|
||||||
m.WsClient.UnderlyingConn().Close()
|
m.WsClient.UnderlyingConn().Close()
|
||||||
m.WsClient = nil
|
|
||||||
_, err := m.Client.Logout()
|
_, err := m.Client.Logout()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -198,14 +197,16 @@ func (m *MMClient) WsReceiver() {
|
|||||||
var rawMsg json.RawMessage
|
var rawMsg json.RawMessage
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if !m.WsConnected {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if m.WsQuit {
|
if m.WsQuit {
|
||||||
m.log.Debug("exiting WsReceiver")
|
m.log.Debug("exiting WsReceiver")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !m.WsConnected {
|
||||||
|
time.Sleep(time.Millisecond * 100)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if _, rawMsg, err = m.WsClient.ReadMessage(); err != nil {
|
if _, rawMsg, err = m.WsClient.ReadMessage(); err != nil {
|
||||||
m.log.Error("error:", err)
|
m.log.Error("error:", err)
|
||||||
// reconnect
|
// reconnect
|
||||||
|
Loading…
Reference in New Issue
Block a user