macos: opt out of App Nap via NSAppSleepDisabled

LSUIElement processes are prime App Nap candidates when idle, and
once App-Napped macOS throttles user-space timers. The ping_pong
keepalive loop in src/connect.rs uses tokio sleeps with a 2 s
ping cycle; if those sleeps slip past the peer's 1 s grace the
peer's watchdog tears down the DTLS connection and the daemon
reconnects from a fresh ephemeral port on the next event — the
"silence-then-new-source-port" pattern visible in the peer's logs
after long idle.

Setting NSAppSleepDisabled keeps the timers running on schedule
across long idle windows. No code-side changes; the key is
honored by macOS for the lifetime of the process.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jon Kinney
2026-04-27 12:59:53 -05:00
committed by Ferdinand Schober
parent 3b4b3a51aa
commit bb1cc805c1

View File

@@ -1,5 +1,7 @@
<key>LSUIElement</key>
<true/>
<key>NSAppSleepDisabled</key>
<true/>
<key>NSInputMonitoringUsageDescription</key>
<string>Lan Mouse needs Input Monitoring access to capture keyboard and mouse input and forward it to remote machines on your network.</string>
<key>NSAppleEventsUsageDescription</key>