1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-07 01:35:39 -05:00

close timer faster

This commit is contained in:
Darien Raymond
2017-05-09 00:01:15 +02:00
parent aea71c2aa8
commit 5829b45bbe
12 changed files with 96 additions and 90 deletions

View File

@@ -278,11 +278,14 @@ func (w *udpWorker) Close() {
}
func (w *udpWorker) monitor() {
timer := time.NewTicker(time.Second * 16)
defer timer.Stop()
for {
select {
case <-w.ctx.Done():
return
case <-time.After(time.Second * 16):
case <-timer.C:
nowSec := time.Now().Unix()
w.Lock()
for addr, conn := range w.activeConn {