mirror of
https://github.com/jahruz67/wisp-open.git
synced 2026-08-08 18:14:08 +00:00
feat: add shutdown functionality for Linux press daemon
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -234,3 +235,13 @@ func (a *App) resetFailedLinuxPressCycle(cycle uint64) {
|
|||||||
pressState.holdMode = false
|
pressState.holdMode = false
|
||||||
pressState.detectingHold = false
|
pressState.detectingHold = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stopLinuxPressDaemon() {
|
||||||
|
if linuxPressServer != nil {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
if err := linuxPressServer.Shutdown(ctx); err != nil {
|
||||||
|
logger.Error("Error shutting down Linux press daemon: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user