-
Notifications
You must be signed in to change notification settings - Fork 328
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
[p2p] support network separation #3817
base: master
Are you sure you want to change the base?
Conversation
go.mod
Outdated
@@ -204,3 +204,5 @@ require ( | |||
replace github.com/ethereum/go-ethereum => github.com/iotexproject/go-ethereum v0.4.2 | |||
|
|||
replace golang.org/x/xerrors => golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3 | |||
|
|||
replace github.com/iotexproject/go-p2p => /Users/chenchen/dev/go-p2p |
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.
create a PR for go-p2p
changes
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.
sure, it's here: iotexproject/go-p2p#36
return | ||
} | ||
|
||
func (p *agent) broadcastTopicName(network string) string { |
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.
topic string
p2p/agent.go
Outdated
@@ -390,6 +432,10 @@ func (p *agent) BroadcastOutbound(ctx context.Context, msg proto.Message) (err e | |||
status, | |||
).Inc() | |||
}() | |||
network, err := p.getMessageNetwork(msg) |
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.
topic, err := p.getMessageTopic(msg)
a.networks[BlockNetwork] = struct{}{} | ||
for _, opt := range opts { | ||
opt(a) | ||
} |
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.
if len(a.networks) == 0 { error out }
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.
node can not join any subnets in p2p level
p2p/agent.go
Outdated
@@ -55,6 +62,8 @@ var ( | |||
) | |||
// ErrAgentNotStarted is the error returned when p2p agent has not been started | |||
ErrAgentNotStarted = errors.New("p2p agent has not been started") | |||
// ErrNoConnectedPeers is a broadcast error when have no connected peers | |||
ErrNoConnectedPeers = p2p.ErrNoConnectedPeers |
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.
delete
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
IIP-16 paused |
da2da0a
to
a45755e
Compare
Quality Gate passedIssues Measures |
status := _successStr | ||
if err != nil { | ||
status = _failureStr | ||
// Skip the broadcast message if it's from the node itself |
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.
move to line 291 or delete
Description
P2P support
block
,action
,consensus
three networks, main changes including:Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: