-
Notifications
You must be signed in to change notification settings - Fork 38
[GH-115] Peers sync #123
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
[GH-115] Peers sync #123
Conversation
|
Please check and advice about code style. This is my first contribution so I probably violated some established rules. |
| else | ||
| case check_peer(uri, own_nonce) do | ||
| {:ok, info} -> | ||
| if map_size(peers) < @peers_max_count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we refactor this if condition into a function, to give it a name
|
code style is good so far, we have no specific rules yet |
| end | ||
| end | ||
|
|
||
| defp should_a_peer_be_added peers_count do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thepiwo Is this what you thought of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes great!
This PR solves following problems:
peers_target_countpeers we add random peers from peers known by peers we know. (We request peers list from peers we know and add random peers from that list)peers_target_countpeers we remove one randomly every "sync loop".Stuff missing for ready peers sync:
This replaces #120
This closes #115