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

Remove global locks from network code #51

Merged
merged 90 commits into from
Jul 17, 2018
Merged

Conversation

lhorgan
Copy link
Contributor

@lhorgan lhorgan commented Jul 12, 2018

  • Connections map replaced with thread-safe version
  • Peer-level locks added
  • Establishment of peer connections now happens separately from fetching of peer info
  • Peer connection order randomized


std::unique_ptr<Storage::Transaction> dbTx(networkdb->begin());
peers->put(dbTx.get(), client->getRemoteAddress().toString(), peerInfo->info);
peers->put(dbTx.get(), client->getRemoteAddress().toString(), connection->getInfo());
Copy link
Member

Choose a reason for hiding this comment

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

This needs to use the cached info value inside connection or there could be a Peer::NetworkError exception. It's also more efficient to use the cached version since it was just set above.

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.

2 participants