You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: close collaborator duplication seams post-decomposition
Tidy the orchestrator/collaborator boundaries flagged by validation:
- daemon_lifecycle gains handle(), a noexcept acquire-load accessor;
the nine webserver run/info methods in webserver_lifecycle.cpp call
it instead of repeating daemon_.daemon.load(memory_order_acquire),
centralizing the memory-order contract in one place.
- route_table gains erase_exact_and_regex_locked_() and
remove_param_prefix_locked_(); unregister_impl_ and
unregister_resource call them instead of poking route_table's raw
tier containers and open-coding the regex remove_if sweep twice.
Drops the now-unused <algorithm>/<regex> includes from
webserver_register.cpp.
- hooks.md: repoint the four fire_*_gated phase-table entries at
webserver_hook_firing.cpp (renamed from webserver_finalize.cpp in
commit 2e73dcb).
Behavior-preserving; 113/113 pass. Also records the validation run's
unworked-findings ledger.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: specs/architecture/04-components/hooks.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,11 @@
11
11
|`request_received`|`webserver_body_pipeline.cpp:requests_answer_first_step` — post header-parse, pre body-read |**yes**| no (route not yet known) |
12
12
|`body_chunk`|`webserver_body_pipeline.cpp:requests_answer_second_step` — per chunk |**yes**| no |
13
13
|`route_resolved`|`webserver_request.cpp:fire_route_resolved_gated` — called from `webserver_request.cpp:finalize_answer`, after lookup | no | n/a (boundary phase) |
14
-
|`before_handler`|`webserver_finalize.cpp:fire_before_handler_gated` — called from `webserver_request.cpp:finalize_answer`, before dispatch |**yes**| yes |
14
+
|`before_handler`|`webserver_hook_firing.cpp:fire_before_handler_gated` — called from `webserver_request.cpp:finalize_answer`, before dispatch |**yes**| yes |
15
15
|`handler_exception`|`webserver_dispatch.cpp:dispatch_resource_handler` — each catch arm |**yes** (maps exception to response) | yes |
16
-
|`after_handler`|`webserver_finalize.cpp:fire_after_handler_gated` — called from `webserver_request.cpp:finalize_answer`|**yes** (replaces response) | yes |
17
-
|`response_sent`|`webserver_finalize.cpp:fire_response_sent_gated` — called from `webserver_request.cpp:materialize_and_queue_response`, post `MHD_queue_response`| no | yes |
18
-
|`request_completed`|`webserver_finalize.cpp:fire_request_completed_gated` — called from `webserver_callbacks.cpp:request_completed`, NOTIFY_COMPLETED | no | yes |
16
+
|`after_handler`|`webserver_hook_firing.cpp:fire_after_handler_gated` — called from `webserver_request.cpp:finalize_answer`|**yes** (replaces response) | yes |
17
+
|`response_sent`|`webserver_hook_firing.cpp:fire_response_sent_gated` — called from `webserver_request.cpp:materialize_and_queue_response`, post `MHD_queue_response`| no | yes |
18
+
|`request_completed`|`webserver_hook_firing.cpp:fire_request_completed_gated` — called from `webserver_callbacks.cpp:request_completed`, NOTIFY_COMPLETED | no | yes |
19
19
|`connection_closed`|`detail/webserver_callbacks_lifecycle.cpp:connection_notify` — NOTIFY_CLOSED | no | no |
20
20
21
21
**Implementation.** Each phase has its own `std::vector<std::function<...>>` in `webserver_impl`, guarded by a single `std::shared_mutex hook_table_mutex_`. A per-phase `std::atomic<bool> any_hooks_[hook_phase::count_]` flag short-circuits the dispatch site to a relaxed atomic load and a compare-with-zero when no subscribers exist — the only hook-related cost on the hot request path for a server with zero hooks registered.
0 commit comments