Skip to main content

Module lifecycle

Module lifecycle 

Source
Expand description

Lifecycle state machine for the HTTP server.

The server follows a strict state progression:

Created → Starting → Running → Draining → Stopped
            ↓                    ↓
         Failed               Failed

§State transitions

  • Created → Starting: Server::start() is called
  • Starting → Running: listener bound, accept loop polled, readiness signaled
  • Starting → Failed: bind, configuration, or accept-loop startup failure
  • Running → Draining: ServerHandle::shutdown() is called
  • Draining → Stopped: all in-flight connections complete or deadline expires
  • Draining → Failed: fatal runtime error during drain

§Allowed operations per state

Statebuildstartreadyshutdownforce_shutdownwait
Createdyesyes-stopstoperr
Starting-erryesstopstoperr
Running-errokokokyes
Draining-errerridempotokyes
Stopped-errerrnoopnoopok
Failed-errerrnoopnooperr

Enums§

LifecycleState
Server lifecycle states.