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

[wpinet] WebSocket: Fix write behavior #5841

Merged
merged 4 commits into from
Oct 29, 2023

Conversation

PeterJohnson
Copy link
Member

@PeterJohnson PeterJohnson commented Oct 28, 2023

On Windows, TryWrite will always return 0 if there is a Write in progress. The previous behavior for SendFrames and SendControl just used a normal Write, which caused issues with code that combined these with TrySendFrames. Instead, have SendFrames and SendControl also use TryWrite under the hood if possible, and create write requests if not. The implementation preserves the priority of SendControl against an existing write request with multiple frames.

Fixes #5817 (the root cause for that was it was not sending the subscription frame due to the WS ping SendControl always occurring immediately before the TrySendFrames).

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
On Windows, TryWrite will always return 0 if there is a Write in
progress. The previous behavior for SendFrames and SendControl just used a
normal Write, which caused issues with code that combined these with
TrySendFrames. Instead, have SendFrames and SendControl also use
TryWrite under the hood if possible, and create write requests if not.
The implementation preserves the priority of SendControl against an existing
write request with multiple frames.
@PeterJohnson PeterJohnson requested a review from a team as a code owner October 28, 2023 01:44
@PeterJohnson PeterJohnson changed the title [wpinet] WebSocket: Improve write behavior [wpinet] WebSocket: Fix write behavior on Windows Oct 28, 2023
@PeterJohnson PeterJohnson changed the title [wpinet] WebSocket: Fix write behavior on Windows [wpinet] WebSocket: Fix write behavior Oct 28, 2023
@PeterJohnson PeterJohnson merged commit 3e7ba2c into wpilibsuite:main Oct 29, 2023
26 checks passed
@PeterJohnson PeterJohnson deleted the wpinet-ws-write branch October 29, 2023 23:49
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.

Dashboards do not re-enumerate values after disconnection and reconnection
1 participant