forked from jshiffer/matterbridge
Fix crash on exit
This commit is contained in:
parent
96e21dd051
commit
131826e1d1
@ -197,11 +197,6 @@ func (m *MMClient) WsReceiver() {
|
||||
for {
|
||||
var rawMsg json.RawMessage
|
||||
var err error
|
||||
if _, rawMsg, err = m.WsClient.ReadMessage(); err != nil {
|
||||
m.log.Error("error:", err)
|
||||
// reconnect
|
||||
m.Login()
|
||||
}
|
||||
|
||||
if !m.WsConnected {
|
||||
continue
|
||||
@ -211,6 +206,12 @@ func (m *MMClient) WsReceiver() {
|
||||
return
|
||||
}
|
||||
|
||||
if _, rawMsg, err = m.WsClient.ReadMessage(); err != nil {
|
||||
m.log.Error("error:", err)
|
||||
// reconnect
|
||||
m.Login()
|
||||
}
|
||||
|
||||
var event model.WebSocketEvent
|
||||
if err := json.Unmarshal(rawMsg, &event); err == nil && event.IsValid() {
|
||||
m.log.Debugf("WsReceiver: %#v", event)
|
||||
|
Loading…
Reference in New Issue
Block a user