-
Notifications
You must be signed in to change notification settings - Fork 3
Initialize P2P communication #87
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
Conversation
* Create p2p testable
Waiting for my enhancement to be included |
* implements Peer cycling mechanism
|
||
// GetMorePeers to collect more peers available | ||
func (psc *PeerServiceClient) GetMorePeers(destPeer *model.Peer) (*model.GetMorePeersResponse, error) { | ||
connection, _ := nativeUtil.GrpcDialer(destPeer) |
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.
GetMorePreers
, 'GetPeerInfo' and SendPeers
try to new handshake connection more and more and more.
or need to figure it out how to control this connection for more efficient way.
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.
we'll get back to this if it is still in concern in the future #97
another thought: |
Good point. Changed the implementation to use |
and for secure random, we can use https://golang.org/pkg/crypto/rand/ |
@andy-shi88 Thanks, @sukrawidhyawan has perform it. |
Description
Initialize basic p2p Communication. For now available service is maintained connected peers & get more peers. Package
service
in p2pnative
will separate from unit test and just functional test (script for test not yet add in this PR) and the rest package still in unit testBreakdown
native
strategynative
service:resolvePeers
&getMorePeers
Reference Issue
Close #12 #71
Step to Test (optional)
go run main.go
,go run main.go -postfix 2
,go run main.go -postfix 3
in 3 separate terminal tabs to run 3 nodes based on 3 different configuration filesResolvedPeers
andUnresolvedPeers
populated and cycled through by runninggo run api/client/GetHostInfo/client.go -ip 127.0.0.1:3001
,go run api/client/GetHostInfo/client.go -ip 127.0.0.1:3002
andgo run api/client/GetHostInfo/client.go -ip 127.0.0.1:3001
to observe the the state of the 3 nodes seperately