Skip to content

Commit

Permalink
p2p: make persistent prop independent of conn direction (tendermint#3593
Browse files Browse the repository at this point in the history
)

## Description

Previously only outbound peers can be persistent.

Now, even if the peer is inbound, if it's marked as persistent, when/if conn is lost,
Tendermint will try to reconnect. This part is actually optional and can be reverted.

Plus, seed won't disconnect from inbound peer if it's marked as
persistent. Fixes tendermint#3362

## Commits

* make persistent prop independent of conn direction

Previously only outbound peers can be persistent. Now, even if the peer
is inbound, if it's marked as persistent, when/if conn is lost,
Tendermint will try to reconnect.

Plus, seed won't disconnect from inbound peer if it's marked as
persistent. Fixes tendermint#3362

* fix TestPEXReactorDialPeer test

* add a changelog entry

* update changelog

* add two tests

* reformat code

* test UnsafeDialPeers and UnsafeDialSeeds

* add TestSwitchDialPeersAsync

* spec: update p2p/config spec

* fixes after Ismail's review

* Apply suggestions from code review

Co-Authored-By: melekes <[email protected]>

* fix merge conflict

* remove sleep from TestPEXReactorDoesNotDisconnectFromPersistentPeerInSeedMode

We don't need it actually.
  • Loading branch information
melekes authored and brapse committed Jun 5, 2019
1 parent d34a2af commit d48b6ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rpc/core/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ func UnsafeDialPeers(ctx *rpctypes.Context, peers []string, persistent bool) (*c
if err := p2pPeers.DialPeersAsync(peers); err != nil {
return &ctypes.ResultDialPeers{}, err
}
// parsing errors are handled above by AddPersistentPeers
_ = p2pPeers.DialPeersAsync(peers)
return &ctypes.ResultDialPeers{Log: "Dialing peers in progress. See /net_info for details"}, nil
}

Expand Down

0 comments on commit d48b6ce

Please sign in to comment.