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

p2p: fix connection leakage when peer is not authorized to connect #897

Merged
merged 2 commits into from
Dec 3, 2019

Conversation

trung
Copy link
Contributor

@trung trung commented Dec 3, 2019

When returning nil in p2p/server.go#setupConn(), it often indicates that the peer connection is established.
In the below scenarios:

  1. Node is not in raft cluster (Restrict p2p connection for non raft peer #884)
  2. Node is not permissioned per smart-contract based permissioning model (Smart contract based permission model #715)

We want to disconnect the peer and clean up the connection. This is done by returning an appropriate peerError which then follows the existing catching and handling logic by the caller.

@jpmsam jpmsam requested a review from jbhurat December 3, 2019 15:53
jpmsam
jpmsam previously approved these changes Dec 3, 2019
jbhurat
jbhurat previously approved these changes Dec 3, 2019
Copy link
Contributor

@jbhurat jbhurat left a comment

Choose a reason for hiding this comment

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

LGTM

@trung trung dismissed stale reviews from jbhurat and jpmsam via 0b8ef62 December 3, 2019 19:28
@jpmsam jpmsam merged commit 151cf6e into Consensys:master Dec 3, 2019
@trung trung deleted the fix-connection-leak branch December 3, 2019 20:36
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