diff --git a/exchanges/stream/websocket.go b/exchanges/stream/websocket.go index d4e6281f..310a3bc2 100644 --- a/exchanges/stream/websocket.go +++ b/exchanges/stream/websocket.go @@ -568,6 +568,8 @@ func (w *Websocket) trafficMonitor() { w.trafficTimeout) } trafficTimer.Stop() + w.setTrafficMonitorRunning(false) + w.Wg.Done() // without this the w.Shutdown() call below will deadlock if !w.IsConnecting() && w.IsConnected() { err := w.Shutdown() if err != nil { @@ -576,8 +578,7 @@ func (w *Websocket) trafficMonitor() { w.exchangeName, err) } } - w.setTrafficMonitorRunning(false) - w.Wg.Done() + return }