Skip to main content

try_attach_to_existing_shell

Function try_attach_to_existing_shell 

Source
pub(super) async fn try_attach_to_existing_shell(
    state: &AppState,
    agent_block_id: &str,
    id: &str,
    connection: &str,
) -> Option<Response>
Expand description

Shared by both the top-level reuse check and the “lost the atomic claim” fallback in handle_pty_shell_create: resync id’s controller and reply, or return None if id doesn’t resolve to a real block (stale pointer), OR if its shell has already exited, so the caller falls through to creating a fresh one. A pane has one agent shell: asking for it, while it runs, on another connection than its own is refused (409), not answered with the shell on the wrong machine. An exited one is replaced whatever its connection was.