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

les: fix UDP connection query #22451

Merged
merged 5 commits into from
Mar 16, 2021
Merged

les: fix UDP connection query #22451

merged 5 commits into from
Mar 16, 2021

Conversation

zsfelfoldi
Copy link
Contributor

This PR fixes multiple issues with the UDP connection pre-negotiation feature:

  • the enable condition was wrong (it checked the existence of the DiscV5 struct where it wasn't initialized yet, disabling the feature even if discv5 was enabled)
  • the server pool queried already connected nodes when the discovery iterators returned them again
  • servers responded positively before they were synced and really willing to accept connections

Metrics are also added on the server side that count the positive and negative replies to served connection queries.

les/client.go Outdated
@@ -116,7 +116,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
}

var prenegQuery vfc.QueryFunc
if leth.p2pServer.DiscV5 != nil {
if stack.Config().P2P.DiscoveryV5 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use this check in all other places. It's true that the discV5 handler will be initialized later if the v5 is enabled, but it's so weird we use different check methods in different places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a flag and an extra check with an error log just to be sure

@rjl493456442
Copy link
Member

Otherwise, lgtm

les/clientpool.go Outdated Show resolved Hide resolved
@holiman holiman added this to the 1.10.2 milestone Mar 16, 2021
@holiman holiman merged commit 6d9707a into ethereum:master Mar 16, 2021
github-actions bot pushed a commit to syuan100/go-ethereum that referenced this pull request Mar 16, 2021
This PR fixes multiple issues with the UDP connection pre-negotiation feature:

- the enable condition was wrong (it checked the existence of the DiscV5 struct where it wasn't initialized yet, disabling the feature even if discv5 was enabled)
- the server pool queried already connected nodes when the discovery iterators returned them again
- servers responded positively before they were synced and really willing to accept connections

Metrics are also added on the server side that count the positive and negative replies to served connection queries.
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
This PR fixes multiple issues with the UDP connection pre-negotiation feature:

- the enable condition was wrong (it checked the existence of the DiscV5 struct where it wasn't initialized yet, disabling the feature even if discv5 was enabled)
- the server pool queried already connected nodes when the discovery iterators returned them again
- servers responded positively before they were synced and really willing to accept connections

Metrics are also added on the server side that count the positive and negative replies to served connection queries.
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
This PR fixes multiple issues with the UDP connection pre-negotiation feature:
- the enable condition was wrong (it checked the existence of the DiscV5 struct where it wasn't initialized yet, disabling the feature even if discv5 was enabled)
- the server pool queried already connected nodes when the discovery iterators returned them again
- servers responded positively before they were synced and really willing to accept connections

Metrics are also added on the server side that count the positive and negative replies to served connection queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants