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.
Structs§
- Step 🔒
- What the watcher does with one answer.
Constants§
- WHILE_
CONNECTING 🔒 - How soon the watcher asks again while a login may be under way.
- WHILE_
UP 🔒 - How soon it asks again while the connection is up.
Statics§
- BROKER 🔒
Functions§
- broker 🔒
- 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. - ended 🔒
settle: a clean last end leaves the connection disconnected, rather than to the watcher. A connection the user disconnected ended because they asked: not an error.- 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. - held_
set 🔒 - hold 🔒
- 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. - login_
ended 🔒 - A login’s own end: connected if it worked (said first, and never settled by its end, since it is the news), 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. - release 🔒
- run 🔒
- shared 🔒
- Whether ssh shares connections here, so there is one to ask.
- started 🔒
- step 🔒
- The watcher’s decision, from the shared connection’s answer (
up;Nonewhen it couldn’t be asked), the connection’s status and open panes, and whether the user disconnected it (held): every login releases that first, so a held connection’s “up” is an answer from before the Disconnect closed it, and is taken as down. - 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. - used_
with 🔒 - watch 🔒
- Make sure
connectionis watched, and have its watcher ask now. - watches 🔒