v0.7.0

Daemon Lifecycle

Last updated


This page explains what Start, Stop, and Close do in server mode and in client mode.

Lifecycle


MethodServer modeClient mode
Start()Non-blocking. Re-probes, returns ErrAlreadyRunning if another daemon answers, removes a stale socket file, listens, and accepts in a goroutine. Calling again while listening is a no-opNo-op
Stop()Closes the listener, waits for the accept loop, closes every open connection, waits for connection goroutinesNo-op
Close()Stop() then Store.Close(), errors joinedCloses idle pooled connections
Mode() / Socket()ModeServer / socket pathModeClient / socket path
Store()The underlying *store.Storenil

A server-mode Daemon dispatches calls in-process, so its own methods work even before Start(). Stop() must close live connections, because pooled client connections would otherwise keep serve() blocked in readFrame and Stop() would never return.
A client does not take over when the server process exits; its calls fail with dial errors until a new daemon.New elects a new server.

中文