mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-31 19:36:20 +00:00
optional panic on AddPeer err
This commit is contained in:
@@ -482,6 +482,8 @@ func MakeConnectedSwitches(n int, initSwitch func(int, *Switch) *Switch, connect
|
||||
return switches
|
||||
}
|
||||
|
||||
var PanicOnAddPeerErr = false
|
||||
|
||||
// Will connect switches i and j via net.Pipe()
|
||||
// Blocks until a conection is established.
|
||||
// NOTE: caller ensures i and j are within bounds
|
||||
@@ -492,14 +494,14 @@ func Connect2Switches(switches []*Switch, i, j int) {
|
||||
doneCh := make(chan struct{})
|
||||
go func() {
|
||||
_, err := switchI.AddPeerWithConnection(c1, false) // AddPeer is blocking, requires handshake.
|
||||
if err != nil {
|
||||
if PanicOnAddPeerErr && err != nil {
|
||||
panic(err)
|
||||
}
|
||||
doneCh <- struct{}{}
|
||||
}()
|
||||
go func() {
|
||||
_, err := switchJ.AddPeerWithConnection(c2, true)
|
||||
if err != nil {
|
||||
if PanicOnAddPeerErr && err != nil {
|
||||
panic(err)
|
||||
}
|
||||
doneCh <- struct{}{}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package p2p
|
||||
|
||||
const Version = "0.3.4" // filter by addr or pubkey
|
||||
const Version = "0.3.5" // minor fixes
|
||||
|
||||
Reference in New Issue
Block a user