feat: add shutdown functionality for Linux press daemon

This commit is contained in:
John Doe
2026-07-10 14:21:06 -07:00
parent 062f09a000
commit 71dbac5413
+11
View File
@@ -10,6 +10,7 @@
package main
import (
"context"
"net/http"
"os"
"sync"
@@ -234,3 +235,13 @@ func (a *App) resetFailedLinuxPressCycle(cycle uint64) {
pressState.holdMode = 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)
}
}
}