mirror of
https://github.com/taigrr/go-fastping
synced 2025-01-18 05:03:15 -08:00
Fixed RunLoop test in the same way as an example
This commit is contained in:
parent
e5a0822b78
commit
5d1967e357
@ -180,13 +180,17 @@ func TestRunLoop(t *testing.T) {
|
|||||||
wait := make(chan bool)
|
wait := make(chan bool)
|
||||||
quit, errch := p.RunLoop()
|
quit, errch := p.RunLoop()
|
||||||
ticker := time.NewTicker(time.Millisecond * 250)
|
ticker := time.NewTicker(time.Millisecond * 250)
|
||||||
|
loop:
|
||||||
|
for {
|
||||||
select {
|
select {
|
||||||
case err := <-errch:
|
case err := <-errch:
|
||||||
t.Fatalf("Pinger returns error %v", err)
|
t.Fatalf("Pinger returns error %v", err)
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
|
ticker.Stop()
|
||||||
quit <- wait
|
quit <- wait
|
||||||
case <-wait:
|
case <-wait:
|
||||||
break
|
break loop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if recvCount < 2 {
|
if recvCount < 2 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user