mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-09-21 15:36:51 +00:00
Wake the current instance after device pause on iOS
This commit is contained in:
@@ -193,6 +193,9 @@ func (s *CommandServer) Start() error {
|
||||
}
|
||||
|
||||
func (s *CommandServer) Close() {
|
||||
if s.endPauseTimer != nil {
|
||||
s.endPauseTimer.Stop()
|
||||
}
|
||||
if s.grpcServer != nil {
|
||||
s.grpcServer.Stop()
|
||||
}
|
||||
@@ -264,13 +267,21 @@ func (s *CommandServer) Pause() {
|
||||
instance.PauseManager().DevicePause()
|
||||
if C.IsIos {
|
||||
if s.endPauseTimer == nil {
|
||||
s.endPauseTimer = time.AfterFunc(time.Minute, instance.PauseManager().DeviceWake)
|
||||
s.endPauseTimer = time.AfterFunc(time.Minute, s.endDevicePause)
|
||||
} else {
|
||||
s.endPauseTimer.Reset(time.Minute)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *CommandServer) endDevicePause() {
|
||||
instance := s.StartedService.Instance()
|
||||
if instance == nil || instance.PauseManager() == nil {
|
||||
return
|
||||
}
|
||||
instance.PauseManager().DeviceWake()
|
||||
}
|
||||
|
||||
func (s *CommandServer) Wake() {
|
||||
recorder := s.powerManager.Recorder()
|
||||
if recorder != nil {
|
||||
|
||||
Reference in New Issue
Block a user