Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client/core: fix conns data races #1280

Merged
merged 1 commit into from Nov 11, 2021
Merged

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Nov 10, 2021

In testing #1141 with manual account disable I hit some races with the c.conns maps.

The one in (*Core).exchangeMap() is a little surprising since that method is used all the time.

@@ -1366,8 +1366,9 @@ func (c *Core) dexConnections() []*dexConnection {
// exchangeMap creates a map of *Exchange keyed by host, including markets and
// orders.
func (c *Core) exchangeMap() map[string]*Exchange {
infos := make(map[string]*Exchange, len(c.conns))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was the len(c.conns). I was just gonna remove the pre-alloc, but it's just as easy to grab the slice first and use it in the range

@chappjc chappjc merged commit 6acc21f into decred:master Nov 11, 2021
@chappjc chappjc deleted the conns-races branch November 11, 2021 13:57
@chappjc chappjc added this to the 0.4 milestone Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants