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
| State | build | start | ready | shutdown | force_shutdown | wait |
|---|---|---|---|---|---|---|
| Created | yes | yes | - | stop | stop | err |
| Starting | - | err | yes | stop | stop | err |
| Running | - | err | ok | ok | ok | yes |
| Draining | - | err | err | idempot | ok | yes |
| Stopped | - | err | err | noop | noop | ok |
| Failed | - | err | err | noop | noop | err |
Enums§
- Lifecycle
State - Server lifecycle states.