mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p : Add missing calls timer/ticker.Stop() for p2p tests
This commit is contained in:
parent
66ed58bfcc
commit
e38b59db53
2 changed files with 3 additions and 1 deletions
|
|
@ -43,6 +43,7 @@ func TestSimRandomResolve(t *testing.T) {
|
|||
|
||||
// A new node joins every 10s.
|
||||
launcher := time.NewTicker(10 * time.Second)
|
||||
defer launcher.Stop()
|
||||
go func() {
|
||||
for range launcher.C {
|
||||
net := sim.launchNode(false)
|
||||
|
|
@ -55,7 +56,6 @@ func TestSimRandomResolve(t *testing.T) {
|
|||
}()
|
||||
|
||||
time.Sleep(3 * time.Hour)
|
||||
launcher.Stop()
|
||||
sim.shutdown()
|
||||
sim.printStats()
|
||||
}
|
||||
|
|
@ -196,6 +196,7 @@ func randomResolves(t *testing.T, s *simulation, net *Network) {
|
|||
}
|
||||
|
||||
timer := time.NewTimer(randtime())
|
||||
defer timer.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@ func (s *ProtocolSession) testExchange(e Exchange) error {
|
|||
t = 2000 * time.Millisecond
|
||||
}
|
||||
alarm := time.NewTimer(t)
|
||||
defer alarm.Stop()
|
||||
select {
|
||||
case err := <-errc:
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue