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

Implement basic peer manager #252

Merged
merged 11 commits into from
Mar 4, 2020
Merged

Implement basic peer manager #252

merged 11 commits into from
Mar 4, 2020

Conversation

austinabell
Copy link
Contributor

@austinabell austinabell commented Mar 3, 2020

Summary of changes
Changes introduced in this pull request:

  • Implements a peer manager, which is basically just a threadsafe hashmap wrapped in an Arc for concurrent access across the network polling thread and the syncing thread
    • Can definitely be improved to handle the invalid responses or disconnect from the peer entirely under certain circumstances, but I decided to not get too opinionated or in depth in this PR
  • Updates config file usage to make it easier and more consolidated to swap out the data directory for the db and network keypair
  • Switched basically all references to the db to Arc pointers to allow these structs to be more easily moved across threads and allow concurrent access to the db. The database only requires immutable access because every implementation including in memory uses locks (idk about rocksdb iternally actually) to get mutable access

easiest way to test current usage is running:

cargo run -p forest -- -c config.toml

in multiple proccesses and changing the config file for each where the data dir config is overriden like so:

data_dir = "test_dir"

or whatever directory you want the chain data placed.

Reference issue to close (if applicable)

Closes #250

Other information and links

@austinabell austinabell merged commit 6aeee77 into master Mar 4, 2020
@austinabell austinabell deleted the austin/peermanager branch March 4, 2020 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PeerManager
4 participants