preserve original address and dial it instead of self-reported address (#1994)

Refs #1720
This commit is contained in:
Anton Kaliaev
2018-07-18 13:23:29 +04:00
committed by GitHub
parent 6c4ca140ed
commit b31ee798bd
5 changed files with 44 additions and 21 deletions

View File

@ -8,8 +8,8 @@ import (
"time"
"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p/conn"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/p2p/conn"
)
const (
@ -281,8 +281,11 @@ func (sw *Switch) StopPeerForError(peer Peer, reason interface{}) {
sw.stopAndRemovePeer(peer, reason)
if peer.IsPersistent() {
// NOTE: this is the self-reported addr, not the original we dialed
go sw.reconnectToPeer(peer.NodeInfo().NetAddress())
addr := peer.OriginalAddr()
if addr == nil {
panic(fmt.Sprintf("persistent peer %v with no original address", peer))
}
go sw.reconnectToPeer(addr)
}
}