refactor: complexity cleanup across protocol state machines, body pumps, and stages (+3 bug fixes)#66
Merged
Merged
Conversation
…ded by force-async reads
…rs from DecodeClientData
…ladder from EncodeRequest
…ion in server manager
…t with single FinishRequest
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
Audit-driven complexity cleanup across the protocol layer (H1.0/H1.1/H2/H3), body pumps, and
connection stages. Net effect: dead code removed, duplicated lifecycle/teardown logic collapsed
into single entry points, and implicit boolean-flag state replaced with explicit state enums.
Includes three bug fixes found during the audit. No public API or wire-format changes.
Bug fixes
ServerSupervisorActor)FlowControlledBodyPump)Returnbefore the firstRentregisters a pool factory (ConnectionObjectPool)Refactorings
New shared components (extracted from duplicated per-protocol code)
ConnectionRateGuard/ReconnectPolicy— shared rate-guard and reconnect logic, previously duplicated across H1.0/H1.1 client and server state machinesHttp3OutboundWriter— single owner of H3 framing and pump credit, extracted from client/server session managersPumpSlotLifecycle— deduplicated slot lifecycle shared by Serial/Multiplexed/FlowControlled body pumps, with unified cancel disciplineState made explicit
ReleaseStreamteardown pathDecomposition of oversized methods
EncodeRequest: connection bootstrap and body-send strategy ladder extractedDecodeClientData/OnResponse: streaming-resume, request-dispatch, and drain-scheduling helpers extracted; response-completion epilogue and keep-alive rearm unifiedStreamManager: body-dispatch and FIN epilogues extracted; headers-frame triage and decode error handling consolidatedApplicationBridgeStage/ connection stage logics: per-request bookkeeping consolidated intoRequestSlotwith a singleFinishRequest; drain predicates deduped, completion entry points unifiedDead code removal
StreamStatemembers in H2/H3, pass-throughTryDecodeEof, dead_streamRunningflag, obsoleteBodyReadContinuestarvation guard (superseded by force-async reads)Tests
New specs for the extracted components (
ConnectionRateGuardSpec,ReconnectPolicySpec,Http3OutboundWriterSpec,Http2StreamStateLifecycleSpec,ServerSupervisorActorSpec) pluscoverage for the three bug fixes. Full unit + stage suite passes.