Enforce one-shot/limited transfers; trigger hooks; stop the server cleanly.
Add a transfer counter and configurable limit.
limit
Introduce on_transfer(path, count) callback to chain stages.
on_transfer(path, count)
Implement an automatic shutdown watcher.
Add a loopback-only admin shutdown endpoint.
Transfer counting shared across routes.
A background thread that stops the server when count >= limit.
count >= limit
POST /__shutdown restricted to 127.0.0.1.
POST /__shutdown
127.0.0.1
Counting Model: Increment on success; define “a transfer”.
Callbacks: Where/when to call; exception handling; idempotency.
Shutdown Watcher: Thread polling vs event-driven; clean resource release.
Admin Endpoint: Restrict by remote_addr, choose method (POST).
remote_addr
HTTP Semantics: 410 Gone when limit reached; rationale.
410 Gone
Milestone: Single successful transfer → server stops deterministically.
Set limit=1 and verify shutdown; set limit=2 and verify 410 on the third attempt.
limit=1
limit=2
410
Simulate callback failure and ensure server stability.
Integrate consistent logging and status markers across all routes.
Last updated 6 months ago