fix: classify OP_FAILED replies as operation failures, not dropped connections - #112
Merged
Merged
Conversation
…nnections A peer that answers OP_FAILED over a healthy authenticated channel was classified as .bodyFailed — the same bucket as a mid-message connection drop. That fed the outbound rate limiter as a host failure (throttling a reachable peer into tooManyRecentFailures) and showed the user "The connection dropped mid-message." when the peer actually answered. Type the body callback as Result<Void, OutgoingFailure>, add .remoteOperationFailed and .invalidResponse, decode OP_SUCCESS/OP_FAILED acks in one shared helper, and count an authenticated OP_FAILED as rate-limiter success since the channel proved healthy. Ported from cssmagic/magic-switch@a912313, minus its fork-only release-lease context.
|
🎉 This PR is included in version 2.25.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
OutgoingConnection.run's body callback was aBool, so a peer that answeredOP_FAILEDover a healthy authenticated channel was classified as.bodyFailed— the same bucket as a mid-message connection drop. Two consequences:tooManyRecentFailures— against a perfectly healthy peer.Changes:
Result<Void, OutgoingFailure>; two new cases distinguish an authenticatedOP_FAILED(.remoteOperationFailed) from a malformed or command-shaped reply (.invalidResponse), each with its own user-facing message.decodeOperationResponsereplaces the four inline OP_SUCCESS comparisons. INTRODUCE keeps its custom reply handling (a legacy peer'sOP_FAILEDstill maps to.legacy).OP_FAILEDnow counts as rate-limiter success: the channel proved healthy, and the failure is the operation's, not the network's.continueAdoptionalready treats any non-connect failure as "peer is up" via its default arm, so adoption/reclaim behavior is unchanged; only its comment reference moves from.bodyFailedto.remoteOperationFailed.Ported from the classification half of cssmagic/magic-switch@a912313, minus its fork-only release-lease context.
Verified with
swift-format lintandswiftc -parseonly — no Xcode on this machine, so this hasn't been built or run against hardware.