Repository navigation
Conversation
Application::on_logout always received the fixed string "peer has logged us out", and a Logout received in answer to our Logon (AwaitingLogon) only disconnected without telling the application at all. A counterparty's reason, such as a refused Logon, never reached the application. on_logout now receives the inbound Logout's Text(58), falling back to the previous generic reason when it has none, and a Logout that refuses our Logon calls on_logout with its text before the disconnect.
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.
Problem
When the counterparty logs us out,
Application::on_logoutalways receives the fixed string "peer has logged us out", whatever reason the counterparty gave. And when the counterparty answers our Logon with a Logout (a refused Logon: wrong credentials, a bad signature, an unknown CompID), the session only disconnects and the application is not told at all. The reason the venue gave, usually the most useful diagnostic for a failed logon, is lost.Change
on_logoutreceives the inbound Logout's Text(58). When the Logout has no Text, or an empty one, it falls back to the previous "peer has logged us out".on_logoutwith its reason before the disconnect. Other unexpected messages in that state still just disconnect.Tests
In
logout_tests.rs, with the fake application now recording everyon_logoutreason:test_counterparty_logout_text_reaches_application: an active session logged out with a reason passes that text to the application.test_counterparty_logout_without_text_reports_generic_reason: a Logout without Text still reports the generic reason.test_logout_in_response_to_logon_reaches_application: a Logout answering our Logon reaches the application with its text before the disconnect.This adds a
given_a_connected_session_with_apptest helper. The decorate-logon PR (#354) adds the same helper, so whichever merges second has a trivial conflict insetup.rs.I could not build this workspace locally, so I am relying on CI for the compile, clippy and test run.
This contribution is offered under the project's MIT licence.