mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-16 23:16:48 +00:00
websocket: fix shutdown deadlock (#1059)
* fix shutdown deadlock * cleanup * Update websocket.go
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user