Repository navigation
connection: share handshake ack parsing and account merge - #959
Open
tradatious wants to merge 1 commit into
Open
tradatious wants to merge 1 commit into
tradatious wants to merge 1 commit into
Conversation
parse_handshake_ack, AccountInfo::merge and ConnectionMetadata::apply_account_info move the runtime-free parts of the sync and async handshakes into connection::common. No behaviour change.
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.
Description
The blocking and async connections each had their own copy of two parts of the startup handshake
that do not depend on the runtime:
mapping a reply that ends in
UnexpectedEoftoError::ConnectionRejected;ConnectionMetadata.Both now live in
connection::commonasparse_handshake_ack,AccountInfo::mergeandConnectionMetadata::apply_account_info, andMAX_ACCOUNT_INFO_ATTEMPTSreplaces the two localMAX_ATTEMPTSconstants. Each connection calls them and keeps only its own I/O and locking.One ordering difference, on both clients: the reply is parsed before the metadata lock is taken,
where it used to be parsed while holding it (on the blocking client a bad reply is therefore
reported ahead of a poisoned lock). Nothing else changes.
Testing
New tests in
connection/common_tests.rs:test_parse_handshake_ack(a valid reply, anUnexpectedEofreply, another I/O error),test_account_info_mergeandtest_connection_metadata_apply_account_info. The existing sync and async handshake tests passunchanged. cargo fmt --check; clippy, rustdoc (-D warnings) and cargo test on all three feature
configurations; cargo build --examples both ways; integration crates built.
Breaking changes
No. Crate-internal.