mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-15 06:08:35 +00:00
p2p: fix a close race in the dial test
This commit is contained in:
parent
7e58949c3f
commit
1cbbfbe7fa
1 changed files with 2 additions and 1 deletions
|
|
@ -117,7 +117,6 @@ func TestServerDial(t *testing.T) {
|
||||||
t.Error("accept error:", err)
|
t.Error("accept error:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
conn.Close()
|
|
||||||
accepted <- conn
|
accepted <- conn
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
@ -134,6 +133,8 @@ func TestServerDial(t *testing.T) {
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case conn := <-accepted:
|
case conn := <-accepted:
|
||||||
|
defer conn.Close()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case peer := <-connected:
|
case peer := <-connected:
|
||||||
if peer.ID() != remid {
|
if peer.ID() != remid {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue