From d8e4f41ac8da9c1133cadaeed61bdef703ca8f51 Mon Sep 17 00:00:00 2001 From: Song Gao Date: Wed, 11 Nov 2015 22:12:44 +0000 Subject: [PATCH] use time.Timer --- ipv4_test.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/ipv4_test.go b/ipv4_test.go index 5c38901..84cb523 100644 --- a/ipv4_test.go +++ b/ipv4_test.go @@ -11,13 +11,6 @@ import ( const BUFFERSIZE = 1522 -func startTimeout(ch chan<- bool, t time.Duration) { - go func() { - time.Sleep(t) - ch <- true - }() -} - func startRead(ch chan<- []byte, ifce *Interface) { go func() { for { @@ -54,8 +47,7 @@ func TestBroadcast(t *testing.T) { dataCh := make(chan []byte, 8) startRead(dataCh, ifce) - timeout := make(chan bool, 1) - startTimeout(timeout, time.Second*8) + timeout := time.NewTimer(8 * time.Second).C readFrame: for {