Export session identity to the sessioncontrol hooks - #2274
Merged
mikebrady merged 1 commit intoSep 4, 2026
Merged
Conversation
command_start() and command_stop() run the sessioncontrol commands
(run_this_before_play_begins / run_this_after_play_ends) via fork and
execv of a fixed command string: no arguments, and nothing about the
session that triggered them. A hook can therefore be told that play
began, but not by whom -- which makes it impossible to distinguish
independent streams from several receivers carrying one grouped
AirPlay 2 stream.
Export the session's identity into the environment immediately before
running each hook. The child inherits it across fork/execv, so neither
the hook command string nor command_start()/command_stop() need to
change:
SPS_CLIENT_IP conn->client_ip_string
SPS_CONNECTION_NUMBER conn->connection_number
SPS_GROUP_ID conn->airplay_gid, the AirPlay 2 group UUID
from the SETUP plist ("" if none)
SPS_GROUP_CONTAINS_LEADER conn->groupContainsGroupLeader
The last two are set to ""/0 on non-AirPlay 2 builds so that a hook can
rely on all four always being present. Nothing inside shairport-sync
reads these; behaviour is unchanged for any configuration that does not
use sessioncontrol hooks.
Owner
|
This is lovely, thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
command_start() and command_stop() run the sessioncontrol commands
(run_this_before_play_begins / run_this_after_play_ends) via fork and
execv of a fixed command string: no arguments, and nothing about the
session that triggered them. A hook can therefore be told that play
began, but not by whom -- which makes it impossible to distinguish
independent streams from several receivers carrying one grouped
AirPlay 2 stream.
Export the session's identity into the environment immediately before
running each hook. The child inherits it across fork/execv, so neither
the hook command string nor command_start()/command_stop() need to
change:
SPS_CLIENT_IP conn->client_ip_string
SPS_CONNECTION_NUMBER conn->connection_number
SPS_GROUP_ID conn->airplay_gid, the AirPlay 2 group UUID
from the SETUP plist ("" if none)
SPS_GROUP_CONTAINS_LEADER conn->groupContainsGroupLeader
The last two are set to ""/0 on non-AirPlay 2 builds so that a hook can
rely on all four always being present. Nothing inside shairport-sync
reads these; behaviour is unchanged for any configuration that does not
use sessioncontrol hooks.