Browse Source

Fix race in test suffix

pull/1520/head
Alexander Simmerl 7 years ago
parent
commit
0cd92a4948
No known key found for this signature in database GPG Key ID: 4694E95C9CC61BDA
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      p2p/peer.go

+ 3
- 4
p2p/peer.go View File

@ -3,6 +3,7 @@ package p2p
import (
"fmt"
"net"
"sync/atomic"
"time"
"github.com/tendermint/go-crypto"
@ -12,7 +13,7 @@ import (
tmconn "github.com/tendermint/tendermint/p2p/conn"
)
var testIPSuffix = 0
var testIPSuffix uint32 = 0
// Peer is an interface representing a peer connected on a reactor.
type Peer interface {
@ -57,11 +58,9 @@ func (pc peerConn) RemoteIP() net.IP {
if pc.conn.RemoteAddr().String() == "pipe" {
pc.ips = []net.IP{
net.IP{172, 16, 0, byte(testIPSuffix)},
net.IP{172, 16, 0, byte(atomic.AddUint32(&testIPSuffix, 1))},
}
testIPSuffix++
return pc.ips[0]
}


Loading…
Cancel
Save