mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
consensus/ethash: wait for listener to start listening
This commit is contained in:
parent
672de17200
commit
6834fd7bb0
1 changed files with 12 additions and 0 deletions
|
|
@ -40,6 +40,18 @@ func TestRemoteNotify(t *testing.T) {
|
||||||
|
|
||||||
go server.Serve(listener)
|
go server.Serve(listener)
|
||||||
|
|
||||||
|
// Wait for server to start listening
|
||||||
|
var tries int
|
||||||
|
for tries = 0; tries < 10; tries++ {
|
||||||
|
conn, _ := net.DialTimeout("tcp", listener.Addr().String(), 1*time.Second)
|
||||||
|
if conn != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if tries == 10 {
|
||||||
|
t.Fatal("tcp listener not ready for more than 10 seconds")
|
||||||
|
}
|
||||||
|
|
||||||
// Create the custom ethash engine
|
// Create the custom ethash engine
|
||||||
ethash := NewTester([]string{"http://" + listener.Addr().String()})
|
ethash := NewTester([]string{"http://" + listener.Addr().String()})
|
||||||
defer ethash.Close()
|
defer ethash.Close()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue