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

fix: one peer occupy multiple tcp connections #2262

Merged
merged 5 commits into from
Dec 31, 2018
Merged

fix: one peer occupy multiple tcp connections #2262

merged 5 commits into from
Dec 31, 2018

Conversation

garyyu
Copy link
Contributor

@garyyu garyyu commented Dec 31, 2018

To close #2258

  • The main improvement is closing TCP stream on fail of peer connect / accept
  • Another correction, (not directly related to this issue), is removing the unnecessary 3 times retry for peer connection request, which was imported by me before, but I think I was over worried on the connection request, since we have 10s timeout for a TCP connecting request:
TcpStream::connect_timeout(addr, Duration::from_secs(10))

And it doesn't make sense to retry in 1 second on any error, and we already have a resurrection mechanism for those p2p::State::Defunct peers.

@garyyu
Copy link
Contributor Author

garyyu commented Dec 31, 2018

Tested in 3 servers for 8 hours, the effect is quite good, no more hundreds of connections.

But for 100% avoid multiple tcp connections on one peer, we need more actions:
1.Ensure all grin nodes have been upgraded to this version (or later versions)
2.New mechanism to save all connected TCP streams, and periodically check and clean those connections which has no data flow (protocol data sending / receiving). This deserves a new PR to do that, but perhaps do it later since it's not a major issue now.

@garyyu garyyu merged commit 738d49d into mimblewimble:master Dec 31, 2018
@garyyu garyyu deleted the 2258 branch January 3, 2019 11:40
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.

One peer occupy multiple TCP connections
1 participant