mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
fix connection lock call
This commit is contained in:
parent
69e76485c5
commit
0b935eff4f
|
@ -326,6 +326,9 @@ func (s *Stream) connect(ctx context.Context) error {
|
|||
log.Infof("listen key is created: %s", MaskKey(listenKey))
|
||||
}
|
||||
|
||||
// should only start one connection one time, so we lock the mutex
|
||||
s.ConnLock.Lock()
|
||||
|
||||
// when in public mode, the listen key is an empty string
|
||||
conn, err := s.dial(listenKey)
|
||||
if err != nil {
|
||||
|
@ -334,8 +337,6 @@ func (s *Stream) connect(ctx context.Context) error {
|
|||
|
||||
log.Infof("websocket connected")
|
||||
|
||||
// should only start one connection one time, so we lock the mutex
|
||||
s.ConnLock.Lock()
|
||||
|
||||
// ensure the previous context is cancelled
|
||||
if s.connCancel != nil {
|
||||
|
|
|
@ -241,6 +241,9 @@ func (s *Stream) connect(ctx context.Context) error {
|
|||
url = okexapi.PrivateWebSocketURL
|
||||
}
|
||||
|
||||
// should only start one connection one time, so we lock the mutex
|
||||
s.connLock.Lock()
|
||||
|
||||
conn, err := s.StandardStream.Dial(url)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -248,8 +251,6 @@ func (s *Stream) connect(ctx context.Context) error {
|
|||
|
||||
log.Infof("websocket connected: %s", url)
|
||||
|
||||
// should only start one connection one time, so we lock the mutex
|
||||
s.connLock.Lock()
|
||||
|
||||
// ensure the previous context is cancelled
|
||||
if s.connCancel != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user