This commit is contained in:
connor committed 2026-10-22 09:21:28 -04:00
1 parent 95dc6e146c
commit 226ac906a2
41 files changed
+992 -38

No files matched your search

+7 -2
View File
@@ -11,9 +11,14 @@ UNIT=sway-headless.service
IDLE_MINUTES="${STREAM_IDLE_MINUTES:-15}"
STAMP="${XDG_RUNTIME_DIR:-/tmp}/stream.lastseen"
# A Moonlight client holds connections to the control and RTSP ports.
# The TCP ports are only held while a session is being launched; once it is
# streaming, everything is UDP on unconnected sockets that ss cannot attribute
# to a peer. A live NVENC session is what shows a stream in progress.
clients_connected() {
ss -Htn state established '( sport = :47984 or sport = :47989 or sport = :48010 )' 2>/dev/null | grep -q .
ss -Htn state established '( sport = :47984 or sport = :47989 or sport = :48010 )' 2>/dev/null | grep -q . && return 0
local sessions
sessions=$(nvidia-smi --query-gpu=encoder.stats.sessionCount --format=csv,noheader,nounits 2>/dev/null | head -n1)
(( ${sessions:-0} > 0 ))
}
vram() {