refactor: fold is_party_alive into party_conn_state
One liveness primitive instead of two. The PID argument was a vestige (format-checked, never probed, since the kill -0 removal); dropping it means a roster with a garbage SERVER_PID can no longer mask a live socket in host/moderation/role resolution.
This commit is contained in:
parent
be3fb049d2
commit
6b94255245
5 changed files with 51 additions and 88 deletions
|
|
@ -15,7 +15,7 @@ setup() {
|
|||
# default 'party' group existing on the host.
|
||||
export TMUX_PARTY_GROUP="$(id -gn)"
|
||||
|
||||
# Spawn a long-lived sleeper so cmd_list's is_party_alive check sees a
|
||||
# Spawn a long-lived sleeper so cmd_list's party_conn_state check sees a
|
||||
# live PID for the "fake server". setup_party_sandbox provides PARTY_TMP.
|
||||
( exec sleep 60 ) &
|
||||
export FAKE_SERVER_PID=$!
|
||||
|
|
@ -23,7 +23,7 @@ setup() {
|
|||
# Recorder: appends every invocation to TMUX_LOG, fakes the few tmux
|
||||
# subcommands cmd_host depends on (creating a placeholder socket file,
|
||||
# answering display-message -p '#{pid}' with the sleeper's PID so
|
||||
# is_party_alive sees it as live), and returns 0 for the rest.
|
||||
# party_conn_state sees it as live), and returns 0 for the rest.
|
||||
export TMUX_LOG="$PARTY_TMP/tmux.log"
|
||||
: > "$TMUX_LOG"
|
||||
cat > "$PARTY_TMP/tmux-stub" <<'STUB'
|
||||
|
|
@ -711,7 +711,7 @@ STUB
|
|||
# Parity with test 76 ('cmd_list skips parties...'), but for the join
|
||||
# resolver. A roster can have a live SERVER_PID (PID reuse, init's pid 1)
|
||||
# and an [ -S ]-passing socket (planted via `nc -lU`) yet not be a real
|
||||
# tmux server. is_party_alive must probe list-clients on every resolver,
|
||||
# tmux server. party_conn_state must probe list-clients on every resolver,
|
||||
# not just cmd_list — otherwise `party join
|
||||
# imposter` would resolve to the imposter and try to attach.
|
||||
legit_dir="$PARTY_SOCKET_DIR/party-$USER:legit2.d"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue