Skip to content

fix: one peer occupy multiple tcp connections#2262

Merged
garyyu merged 5 commits intomimblewimble:masterfrom
garyyu:2258
Dec 31, 2018
Merged

fix: one peer occupy multiple tcp connections#2262
garyyu merged 5 commits intomimblewimble:masterfrom
garyyu:2258

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