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

Protocol methods refactoring. #182

Merged
merged 16 commits into from
Dec 10, 2019
Merged

Protocol methods refactoring. #182

merged 16 commits into from
Dec 10, 2019

Conversation

CPerezz
Copy link
Contributor

@CPerezz CPerezz commented Dec 8, 2019

The issue comes out from #141 and closes #180

The protocol methods for the node have been refactored.

  • Created polling methods for bootstrapping nodes and network discovery nodes.
  • Refactored logger messages.
  • Moved the logic away from the protocol.go methods and send it to the router.go polling methods. Which are blocking and await for the responses to PING and FIND_NODES messages.

CPerezz added 16 commits December 6, 2019 02:06
Since `Sleep` was not an option as discussed in
 #141, the waitGroup has been implemented in order to
make the program itself trigger the protocol methods
once a packet type in concrete is received.

Also, added state-vars in order to force the
`packetProcessor` gorutine to just activate the
waitGroup if a bootstrapping or network discovery
process is in progress.

Now we need to add timeouts in order to prevent the
app to get stucked at any protocol method execution.
On this way, we speed up the app by copying directly in the stack.
Now that we are using a different aproach with
waitgroups, we can get rid of this state variables.
Now the `Router` provides blocking methods to
poll Bootstrapp node and closestPeers (FIND_NODES)
to allow a better and more logical library construction
also featuring waitGroups and removing the timeouts.
Now that the `Router` offers blocking methods to
search for the closest `alpha` peers and for polling
the bootstrapping nodes, the logic can be leaved there
and the protocol functions just take car of the logic of
the algorithms itself.
We should not send the poll messages inside of the
afterFunc, instead, we should send the messages on
polling methods and wait on the afterFunc to execute
the getters to our tree.
With lower timings we should be able to get all
of the info we are expecting on the polling methods.
@CPerezz CPerezz added type:rfc Changing the behaviour of something already defined area:architecture Issues related to general architectural improvements to enhance performance and/or maintainabilty labels Dec 8, 2019
@CPerezz CPerezz self-assigned this Dec 8, 2019
@CPerezz
Copy link
Contributor Author

CPerezz commented Dec 9, 2019

Maybe there's no need for review since @autholykos is aware of all of the modifications. We discussed them during the weekend.

Can this be merged? It's tested and working as it was with the Sleep() but refactored properly.

@autholykos autholykos merged commit bdd07a7 into kadcast Dec 10, 2019
@jules jules deleted the protocol_sync branch December 10, 2019 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:architecture Issues related to general architectural improvements to enhance performance and/or maintainabilty type:rfc Changing the behaviour of something already defined
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants