mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-01 15:05:35 -05:00
remove context in struct
This commit is contained in:
@@ -10,14 +10,14 @@ type ActivityUpdater interface {
|
||||
}
|
||||
|
||||
type ActivityTimer struct {
|
||||
updated chan bool
|
||||
updated chan struct{}
|
||||
timeout chan time.Duration
|
||||
closing chan bool
|
||||
closing chan struct{}
|
||||
}
|
||||
|
||||
func (t *ActivityTimer) Update() {
|
||||
select {
|
||||
case t.updated <- true:
|
||||
case t.updated <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -72,8 +72,8 @@ func (t *ActivityTimer) run(ctx context.Context, cancel context.CancelFunc) {
|
||||
func CancelAfterInactivity(ctx context.Context, cancel context.CancelFunc, timeout time.Duration) *ActivityTimer {
|
||||
timer := &ActivityTimer{
|
||||
timeout: make(chan time.Duration, 1),
|
||||
updated: make(chan bool, 1),
|
||||
closing: make(chan bool),
|
||||
updated: make(chan struct{}, 1),
|
||||
closing: make(chan struct{}),
|
||||
}
|
||||
timer.timeout <- timeout
|
||||
go timer.run(ctx, cancel)
|
||||
|
||||
Reference in New Issue
Block a user