mirror of
https://github.com/yggdrasil-network/water.git
synced 2025-05-19 16:35:10 +03:00
use time.Timer
This commit is contained in:
parent
965ca414a6
commit
d8e4f41ac8
1 changed files with 1 additions and 9 deletions
10
ipv4_test.go
10
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue