1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-10-08 10:04:03 -04:00

unified task package

This commit is contained in:
Darien Raymond
2018-05-27 13:02:29 +02:00
parent 7fa4bb434b
commit 13f3c356ca
21 changed files with 252 additions and 66 deletions

View File

@@ -19,7 +19,7 @@ import (
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/serial"
"v2ray.com/core/common/signal"
"v2ray.com/core/common/task"
"v2ray.com/core/proxy/vmess"
)
@@ -33,7 +33,7 @@ type sessionId struct {
type SessionHistory struct {
sync.RWMutex
cache map[sessionId]time.Time
task *signal.PeriodicTask
task *task.Periodic
}
// NewSessionHistory creates a new SessionHistory object.
@@ -41,7 +41,7 @@ func NewSessionHistory() *SessionHistory {
h := &SessionHistory{
cache: make(map[sessionId]time.Time, 128),
}
h.task = &signal.PeriodicTask{
h.task = &task.Periodic{
Interval: time.Second * 30,
Execute: func() error {
h.removeExpiredEntries()