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 {
|
for {
|
||||||
var rawMsg json.RawMessage
|
var rawMsg json.RawMessage
|
||||||
var err error
|
var err error
|
||||||
if _, rawMsg, err = m.WsClient.ReadMessage(); err != nil {
|
|
||||||
m.log.Error("error:", err)
|
|
||||||
// reconnect
|
|
||||||
m.Login()
|
|
||||||
}
|
|
||||||
|
|
||||||
if !m.WsConnected {
|
if !m.WsConnected {
|
||||||
continue
|
continue
|
||||||
@ -211,6 +206,12 @@ func (m *MMClient) WsReceiver() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, rawMsg, err = m.WsClient.ReadMessage(); err != nil {
|
||||||
|
m.log.Error("error:", err)
|
||||||
|
// reconnect
|
||||||
|
m.Login()
|
||||||
|
}
|
||||||
|
|
||||||
var event model.WebSocketEvent
|
var event model.WebSocketEvent
|
||||||
if err := json.Unmarshal(rawMsg, &event); err == nil && event.IsValid() {
|
if err := json.Unmarshal(rawMsg, &event); err == nil && event.IsValid() {
|
||||||
m.log.Debugf("WsReceiver: %#v", event)
|
m.log.Debugf("WsReceiver: %#v", event)
|
||||||
|
Loading…
Reference in New Issue
Block a user