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

Better error hanndling during client & server start, and during handshakes #4790

Commits on May 22, 2024

  1. Stronger exception guarantees when starting servers

    For both `MapToolClient.start()`, if an `IOException` is thrown we now guarantee that the state will be `Closed`. This
    means the caller doesn't have to worry about cleaning up the client by calling `.close()` themselves on an object with
    some indeterminate state. Similar thing for `MapToolServer.start()` - its state will be set to `Stopped` if an
    `IOException` is thrown.
    
    `MapTool.startServer()` now relies on this by catching any `IOException` from the client. In this case it stops the
    server before propagating the exception. This makes sure both client and server are in a determinate state if
    `startServer()` fails.
    
    The change to `SocketServer.start()` is only to make it more clear what the state will be in case of a failure.
    kwvanderlinde committed May 22, 2024
    Configuration menu
    Copy the full SHA
    8e5263f View commit details
    Browse the repository at this point in the history

Commits on May 23, 2024

  1. Reorganize logic for handshake completion and disconnection handlers

    onComplete callbacks ow receive a flag indicating whether the handshake was successful. This allows us to bail early and
    to avoid proceeding with logic that assumes a successful connection. On the disconnect side, some logic was moved around
    to where it makes more sense, in particular expected disconnects resulting from `AppActions.DISCONNECT_FROM_SERVER`.
    
    Clients are now created after their respective servers if any. This isn't a huge deal, but is more intuitive and allows
    us a bit of an easier time in the client disconnect handler.
    kwvanderlinde committed May 23, 2024
    Configuration menu
    Copy the full SHA
    4b31743 View commit details
    Browse the repository at this point in the history
  2. Fix phrasing of error for handshake verion mismatches

    The parameters were never been filled because the server does not produce its version in the handshake message. This
    could be fixed, but comes with BC concerns so I just fixed the strings for now.
    kwvanderlinde committed May 23, 2024
    Configuration menu
    Copy the full SHA
    787cd61 View commit details
    Browse the repository at this point in the history