diff --git a/exchanges/stream/websocket.go b/exchanges/stream/websocket.go index 7d1d402d161..404d76d86f1 100644 --- a/exchanges/stream/websocket.go +++ b/exchanges/stream/websocket.go @@ -477,10 +477,11 @@ func (w *Websocket) Shutdown() error { w.subscriptions = subscriptionMap{} w.subscriptionMutex.Unlock() + w.setState(disconnected) + close(w.ShutdownC) w.Wg.Wait() w.ShutdownC = make(chan struct{}) - w.setState(disconnected) if w.verbose { log.Debugf(log.WebsocketMgr, "%v websocket: completed websocket shutdown", w.exchangeName) }