call matchingBooksMutex when assigning matching book

This commit is contained in:
c9s 2021-12-05 12:06:36 +08:00
parent c70369084e
commit 4d7fe7f37d

View File

@ -70,7 +70,9 @@ func (s *Stream) Connect(ctx context.Context) error {
matching.OnTradeUpdate(s.EmitTradeUpdate) matching.OnTradeUpdate(s.EmitTradeUpdate)
matching.OnOrderUpdate(s.EmitOrderUpdate) matching.OnOrderUpdate(s.EmitOrderUpdate)
matching.OnBalanceUpdate(s.EmitBalanceUpdate) matching.OnBalanceUpdate(s.EmitBalanceUpdate)
s.exchange.matchingBooksMutex.Lock()
s.exchange.matchingBooks[symbol] = matching s.exchange.matchingBooks[symbol] = matching
s.exchange.matchingBooksMutex.Unlock()
} }
// assign user data stream back // assign user data stream back