Skip to content

feat: pass the counterparty's Logout text to the application - #357

Open
fraVlaca wants to merge 1 commit into
Validus-Risk-Management:mainfrom
fraVlaca:feat/logout-text-to-application
Open

fraVlaca wants to merge 1 commit into
Validus-Risk-Management:mainfrom
fraVlaca:feat/logout-text-to-application

Conversation

@fraVlaca

Copy link
Copy Markdown

Problem

When the counterparty logs us out, Application::on_logout always 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_logout receives 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".
  • A Logout received while awaiting the Logon response calls on_logout with 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 every on_logout reason:

  • 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_app test helper. The decorate-logon PR (#354) adds the same helper, so whichever merges second has a trivial conflict in setup.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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant