Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify fault and restart code #1568

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

mkeeter
Copy link
Contributor

@mkeeter mkeeter commented Nov 20, 2024

The conditions under which we restart a client IO task are somewhat baroque:

  • It may halt spontaneously (e.g. upon a socket error)
  • We may fault it explicitly (e.g. upon IO error). In this case, we want to skip all work associated with this client.
  • We may restart the IO task if initial negotiation fails
  • ...and when replacing a Downstairs
  • ...and when deactivated

This PR adds more specific types: enum ClientNegotiationFailed and enum ClientFaultReason. Mid-negotiation restarts must provide a ClientNegotiationFailed; faulting the IO task must provide a ClientFaultReason. Both of these types are then converted into a ClientStopReason for logging.

In addition, faulting a client is now done through Downstairs::fault_client instead of calling both Downstairs::skip_all_jobs and DownstairsClient::fault. Having a single function makes this harder to mess up!

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