rpc: /dial_peers: only mark peers as persistent if flag is on (#3620)

## Description

also

    handle errors from DialPeersAsync
    remove nil addr from log msg
    fix TestPEXReactorDoesNotDisconnectFromPersistentPeerInSeedMode

This is a follow-up from
#3593 (review)

Fixes most of the #3617, except #3593 (comment)

## Commits

* rpc: /dial_peers: only mark peers as persistent if flag is on

also

- handle errors from DialPeersAsync
- remove nil addr from log msg
- fix TestPEXReactorDoesNotDisconnectFromPersistentPeerInSeedMode

This is a follow-up from
https://github.com/tendermint/tendermint/pull/3593#pullrequestreview-233556909

* remove a call to AddPersistentPeers

TestDialFail will trigger a reconnect
This commit is contained in:
Anton Kaliaev
2019-05-07 11:09:06 +04:00
committed by GitHub
parent 2bb1a87d41
commit 1e073817de
5 changed files with 17 additions and 9 deletions

View File

@ -682,8 +682,10 @@ func (n *Node) OnStart() error {
}
// Always connect to persistent peers
// parsing errors are handled above by AddPersistentPeers
_ = n.sw.DialPeersAsync(splitAndTrimEmpty(n.config.P2P.PersistentPeers, ",", " "))
err = n.sw.DialPeersAsync(splitAndTrimEmpty(n.config.P2P.PersistentPeers, ",", " "))
if err != nil {
return errors.Wrap(err, "could not dial peers from persistent_peers field")
}
return nil
}