mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-07 19:54:56 +03:00
Update sing-box core, refactor MASQUE, update XHTTP
This commit is contained in:
@@ -55,17 +55,13 @@ func newAdaptiveTimer(logger log.ContextLogger, router adapter.Router, config ti
|
||||
}
|
||||
}
|
||||
|
||||
func (t *adaptiveTimer) start(_ uint64) {
|
||||
t.access.Lock()
|
||||
defer t.access.Unlock()
|
||||
t.startLocked()
|
||||
}
|
||||
|
||||
func (t *adaptiveTimer) startNow() {
|
||||
func (t *adaptiveTimer) start(immediate bool) {
|
||||
t.access.Lock()
|
||||
t.startLocked()
|
||||
t.access.Unlock()
|
||||
t.poll()
|
||||
if immediate {
|
||||
t.poll()
|
||||
}
|
||||
}
|
||||
|
||||
func (t *adaptiveTimer) startLocked() {
|
||||
@@ -90,12 +86,6 @@ func (t *adaptiveTimer) stopLocked() {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *adaptiveTimer) running() bool {
|
||||
t.access.Lock()
|
||||
defer t.access.Unlock()
|
||||
return t.timer != nil
|
||||
}
|
||||
|
||||
func (t *adaptiveTimer) poll() {
|
||||
t.access.Lock()
|
||||
defer t.access.Unlock()
|
||||
@@ -144,13 +134,8 @@ func (t *adaptiveTimer) poll() {
|
||||
interval = t.maxInterval
|
||||
} else {
|
||||
timeToLimit := time.Duration(float64(remaining) / float64(delta) * float64(t.lastInterval))
|
||||
interval = timeToLimit / time.Duration(t.checksBeforeLimit)
|
||||
if interval < t.minInterval {
|
||||
interval = t.minInterval
|
||||
}
|
||||
if interval > t.maxInterval {
|
||||
interval = t.maxInterval
|
||||
}
|
||||
interval = max(timeToLimit/time.Duration(t.checksBeforeLimit), t.minInterval)
|
||||
interval = min(interval, t.maxInterval)
|
||||
}
|
||||
|
||||
t.lastInterval = interval
|
||||
|
||||
Reference in New Issue
Block a user