mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-24 18:21:38 +00:00
p2p: use fake net.Pipe since only >=Go1.10 implements SetDeadline
Fixes https://github.com/tendermint/tendermint/issues/851
Go1.9 and below's net.Pipe did not implement the SetDeadline
method so after commit
e2dd8ca946
this problem was exposed since now we check for errors.
To counter this problem, implement a simple composition for
net.Conn that always returns nil on SetDeadline instead of
tripping out.
Added build tags so that anyone using go1.10 when it is released
will be able to automatically use net.Pipe's net.Conns
This commit is contained in:
@ -160,7 +160,7 @@ func TestConnAddrFilter(t *testing.T) {
|
||||
defer s1.Stop()
|
||||
defer s2.Stop()
|
||||
|
||||
c1, c2 := net.Pipe()
|
||||
c1, c2 := netPipe()
|
||||
|
||||
s1.SetAddrFilter(func(addr net.Addr) error {
|
||||
if addr.String() == c1.RemoteAddr().String() {
|
||||
@ -194,7 +194,7 @@ func TestConnPubKeyFilter(t *testing.T) {
|
||||
defer s1.Stop()
|
||||
defer s2.Stop()
|
||||
|
||||
c1, c2 := net.Pipe()
|
||||
c1, c2 := netPipe()
|
||||
|
||||
// set pubkey filter
|
||||
s1.SetPubKeyFilter(func(pubkey crypto.PubKeyEd25519) error {
|
||||
|
Reference in New Issue
Block a user