Expand description
Whether an SSH connection is up, as its Remotes row and the overlay on its
panes show it (status), kept true to the connection itself.
On macOS and Linux every ssh srv runs on a connection shares one
connection with the others (ControlMaster, ssh.rs), and that shared
connection is the truth: it exists only once the user has logged in, and
ssh -O check answers then and only then. A pane’s ssh starting is only
connecting (it may be waiting at a password prompt), and the connection can
outlive its last pane (ControlPersist) or end under it. So while a
connection is in use a watcher asks it, every half second while connecting
and every 15 s once up, and moves the status when the answer changes:
connected once logged in, disconnected once it is gone, whenever that is.
Where ssh can’t share connections (Windows) there is nothing to ask: a
running ssh counts as connected, as it always did.
The user’s Disconnect (disconnect) closes the shared connection, and
the connection stays down until something logs in to it again: durable
panes on it wait for the user (held) instead of logging back in.
Functions§
- disconnect
- The user’s Disconnect: close
connection’s shared connection (every session on it ends) and keep it down until something logs in again. - disconnected_
note - The line a pane on
connectionshows when the user’s Disconnect ended it. - held
- Whether the user disconnected
connectionand nothing has logged in to it since: a durable pane that lost it waits for the user instead of reconnecting. - init
- Where status changes are published, set once at startup. Until then (and in unit tests) a status is recorded but not published.
- login
- Log in over
connection(attempt: a command over it), holding the connection open meanwhile like a pane, so its status is connecting while the user answers a prompt, connected once the command succeeded, and the failure if it didn’t. - pane_
ended - A pane’s process on
connectionended;errorwhen it had no connection or lost it. - pane_
started - A pane’s process on
connectionstarted (a plain pane’sssh, a durable pane’s attach).logged_in: it is known to be a live login already (a durable pane’s helper answered); otherwise it is connecting until the shared connection answers. - used
- Something used
connectionsuccessfully (a command over it, such as a Files pane’s helper starting): it is up, and where ssh shares connections its status follows the shared connection from here.