mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p/simulations : avoid duplicate unsubscribe
This commit is contained in:
parent
e3eeb64c94
commit
8b95e77770
1 changed files with 5 additions and 1 deletions
|
|
@ -76,7 +76,11 @@ func TestSnapshot(t *testing.T) {
|
|||
// subscribe to peer events
|
||||
evC := make(chan *Event)
|
||||
sub := network.Events().Subscribe(evC)
|
||||
defer sub.Unsubscribe()
|
||||
defer func() {
|
||||
if !sub.Closed() {
|
||||
sub.Unsubscribe()
|
||||
}
|
||||
}()
|
||||
|
||||
// connect nodes in a ring
|
||||
// spawn separate thread to avoid deadlock in the event listeners
|
||||
|
|
|
|||
Loading…
Reference in a new issue