-
Notifications
You must be signed in to change notification settings - Fork 258
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
More client lifecycle improvements #4777
Merged
cwisniew
merged 6 commits into
RPTools:develop
from
kwvanderlinde:bugfix/4776-heartbeat-interleaved-with-handshake
May 20, 2024
Merged
More client lifecycle improvements #4777
cwisniew
merged 6 commits into
RPTools:develop
from
kwvanderlinde:bugfix/4776-heartbeat-interleaved-with-handshake
May 20, 2024
Conversation
This file contains 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
kwvanderlinde
force-pushed
the
bugfix/4776-heartbeat-interleaved-with-handshake
branch
10 times, most recently
from
May 14, 2024 07:21
336e8bc
to
0f06a23
Compare
Otherwise there is a timing bug where if the client happens to respond quickly and the handshake thread happens to be suspended between sending the message and setting the state.
This removes the need for `HandshakeObserver` as well as most methods on `Handshake`, since the information can now be obtained through the future results. Handshakes also register and unregister themselves as message handlers. This removes the need for `releaseHandshake()`, as well as for `MapToolServerConnection` to keep track of handshakes.
kwvanderlinde
force-pushed
the
bugfix/4776-heartbeat-interleaved-with-handshake
branch
2 times, most recently
from
May 14, 2024 07:51
08e8b3e
to
e9f8422
Compare
kwvanderlinde
force-pushed
the
bugfix/4776-heartbeat-interleaved-with-handshake
branch
3 times, most recently
from
May 16, 2024 23:14
3d34660
to
2e92e1e
Compare
The client can now be in one of these states: `New`; `Started`; `Connected`; `Closed`. When transitioning states, we check that we are in an acceptable state or otherwise disallow the transition. This ensures that calls like `start()` or `stop()` can only be effected once. ServerCommandClientImpl will now avoid sending messages unless the client state is `Connected`. Among other things, this prevents unwanted heartbeats from being sent during handshakes.
Instead, the sole observable player database (`PasswordFilePlayerDatabase`) will fire these events. `PlayerDatabaseDialogController` is the only listener and now registers directly on the database. The public API of `Players` has also been reduced, either by privatizing methods or removing trivial wrappers of its player database.
kwvanderlinde
force-pushed
the
bugfix/4776-heartbeat-interleaved-with-handshake
branch
from
May 16, 2024 23:16
2e92e1e
to
49b9254
Compare
I've pared this down to the more essential stuff. I'll do a follow-up PR afteward that really streamlines server init in general. |
thelsing
reviewed
May 17, 2024
thelsing
approved these changes
May 17, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM beside the one typo.
kwvanderlinde
deleted the
bugfix/4776-heartbeat-interleaved-with-handshake
branch
May 20, 2024 04:06
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.
Identify the Bug or Feature request
Addresses #4776, follow up to PR #4771
Description of the Change
The main change here is the bug fix for #4776:
ServerCommand
will now only send messages if the client has finished its handshake. This is done by givingMapToolClient
an explicit set of states:New
when first created;Started
after the handshake is started on aNew
client;Connected
when the handshake completes for aStarted
client;Closed
wheneverclose()
is called regardless of previous state.Second is that handshakes are future-based now which really cleans up the amount of code dedicated to observer them and getting results.
Third is some minor fixes and clean up related to the player database UI.
Possible Drawbacks
Hopefully none ...
Documentation Notes
N/A
Release Notes
N/A
This change is