1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-05 16:55:27 -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

@@ -141,11 +141,14 @@ func (h *DynamicInboundHandler) refresh() error {
}
func (h *DynamicInboundHandler) monitor() {
timer := time.NewTicker(time.Minute * time.Duration(h.receiverConfig.AllocationStrategy.GetRefreshValue()))
defer timer.Stop()
for {
select {
case <-h.ctx.Done():
return
case <-time.After(time.Minute * time.Duration(h.receiverConfig.AllocationStrategy.GetRefreshValue())):
case <-timer.C:
h.refresh()
}
}