mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-10-25 05:41:07 +00:00
Wake the current instance after device pause on iOS
This commit is contained in:
parent
c827ec8303
commit
54e5c497bb
1 changed files with 12 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue