1
0
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:
Darien Raymond
2018-02-08 15:39:46 +01:00
parent a1ae4aa515
commit efcb567273
44 changed files with 379 additions and 270 deletions

View File

@@ -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)