1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-28 04:55:37 -05:00

clean up dns package

This commit is contained in:
Darien Raymond
2017-11-15 00:36:14 +01:00
parent a430e2065a
commit 0dbfb66126
16 changed files with 225 additions and 79 deletions

View File

@@ -13,7 +13,8 @@ import (
func TestActivityTimer(t *testing.T) {
assert := With(t)
ctx, timer := CancelAfterInactivity(context.Background(), time.Second*5)
ctx, cancel := context.WithCancel(context.Background())
timer := CancelAfterInactivity(ctx, cancel, time.Second*5)
time.Sleep(time.Second * 6)
assert(ctx.Err(), IsNotNil)
runtime.KeepAlive(timer)
@@ -22,7 +23,8 @@ func TestActivityTimer(t *testing.T) {
func TestActivityTimerUpdate(t *testing.T) {
assert := With(t)
ctx, timer := CancelAfterInactivity(context.Background(), time.Second*10)
ctx, cancel := context.WithCancel(context.Background())
timer := CancelAfterInactivity(ctx, cancel, time.Second*10)
time.Sleep(time.Second * 3)
assert(ctx.Err(), IsNil)
timer.SetTimeout(time.Second * 1)