Merged
Conversation
Wire up the gw_handler pipeline that was declared in gateway.h but never used. Handlers registered via gateway_register_handler() now run in registration order before service dispatch. A handler returning 1 consumes the message (stops the chain); returning 0 passes it to the next handler; returning <0 is an error (logged and stops the chain). This enables message filtering, transformation, and rate limiting without modifying the service dispatch logic. Added gateway_stats.filtered counter for messages consumed by pipeline handlers. Unit tests: 3 new tests (handler register, overflow, stats). All 25 unit tests pass. Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gw_handlerpipeline declared ingateway.hbut never implementedgateway_register_handler(name, fn)adds handlers to a static chain (max 8)dispatch_msg()runs handlers in registration order before service dispatchgateway_stats.filteredcounter tracks messages consumed by pipelineMemory cost: ~64 bytes (8 x 8B handler slots).
Enables message filtering, transformation, and rate limiting as pre-dispatch hooks without touching the service dispatch logic.
Test plan
make test-unit— 25/25 passed (3 new gateway handler tests)scripts/check-patch.sh --staged— 0 errors, 0 warnings