Skip to main content

run

Function run 

Source
pub async fn run(home: &Path, secret: SecretKey) -> Result<(), NodeError>
Expand description

Run the node in the foreground until it receives a shutdown signal or a Command::Shutdown.

On entry the function:

  1. bootstraps the seeder under <home>/artifacts/
  2. probes the control socket — if a live owner answers, returns NodeError::AlreadyRunning; if the socket file exists but nothing answers, unlinks it
  3. binds the socket with 0600 perms
  4. installs SIGTERM/SIGINT handlers and runs the accept loop

On exit the function drains in-flight handlers (up to DRAIN_TIMEOUT) and shuts the iroh router down (capped by ROUTER_SHUTDOWN_TIMEOUT). The socket file is unlinked. Seeded tags are intentionally left in place so a restart resumes the prior set.