Browse Source

optional panic on AddPeer err

pull/456/head
Ethan Buchman 8 years ago
parent
commit
67c9086b74
2 changed files with 5 additions and 3 deletions
  1. +4
    -2
      switch.go
  2. +1
    -1
      version.go

+ 4
- 2
switch.go View File

@ -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
- 1
version.go View File

@ -1,3 +1,3 @@
package p2p
const Version = "0.3.4" // filter by addr or pubkey
const Version = "0.3.5" // minor fixes

Loading…
Cancel
Save