aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/crypto_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/crypto_test.go')
-rw-r--r--p2p/crypto_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/p2p/crypto_test.go b/p2p/crypto_test.go
index 5fbdc61e3..47b16040a 100644
--- a/p2p/crypto_test.go
+++ b/p2p/crypto_test.go
@@ -8,6 +8,7 @@ import (
"fmt"
"net"
"testing"
+ "time"
"github.com/ethereum/go-ethereum/crypto"
"github.com/obscuren/ecies"
@@ -184,7 +185,17 @@ func TestPeersHandshake(t *testing.T) {
_, err := receiver.loop()
errc1 <- err
}()
+ ready := make(chan bool)
+ go func() {
+ <-initiator.cryptoReady
+ <-receiver.cryptoReady
+ close(ready)
+ }()
+ timeout := time.After(1 * time.Second)
select {
+ case <-ready:
+ case <-timeout:
+ t.Errorf("crypto handshake hanging for too long")
case err = <-errc0:
t.Errorf("peer 0 quit with error: %v", err)
case err = <-errc1: