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

RCORE-2210 Remove unused websocket too new/old errors #7917

Merged
merged 3 commits into from
Jul 24, 2024

Conversation

jbreams
Copy link
Contributor

@jbreams jbreams commented Jul 23, 2024

What, How & Why?

The 403 error message sent by the C++ legacy server that would cause these websocket errors was never sent by baas and we have no tests for this case. So this is just dead code that should be safe to remove.

I put the changelog entry in the Breaking Changes section since this is a slight API change, but maybe it's more an Internal change?

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed
  • bindgen/spec.yml, if public C++ API changed

Copy link

coveralls-official bot commented Jul 23, 2024

Pull Request Test Coverage Report for Build jonathan.reams_3361

Details

  • 1 of 3 (33.33%) changed or added relevant lines in 2 files are covered.
  • 138 unchanged lines in 16 files lost coverage.
  • Overall coverage decreased (-0.03%) to 91.005%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/sync/noinst/server/server.cpp 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
src/realm/mixed.cpp 1 86.61%
src/realm/util/compression.cpp 1 89.62%
test/fuzz_tester.hpp 1 57.73%
test/test_index_string.cpp 1 93.48%
src/realm/array_blobs_big.cpp 2 98.58%
src/realm/object-store/shared_realm.cpp 2 91.89%
src/realm/sync/network/websocket.cpp 2 72.2%
src/realm/unicode.cpp 3 83.83%
src/realm/table.cpp 4 90.42%
src/realm/sync/noinst/client_impl_base.cpp 5 82.29%
Totals Coverage Status
Change from base Build 2512: -0.03%
Covered Lines: 216333
Relevant Lines: 237716

💛 - Coveralls

@jbreams jbreams requested review from tgoyne and danieltabacaru July 23, 2024 18:55
@@ -94,6 +94,7 @@ class DefaultWebSocketImpl final : public DefaultWebSocket, public Config {
{
WebSocketError error = WebSocketError::websocket_ok;
bool was_clean = true;
std::string msg = body.empty() ? ec.message() : std::string{body};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could avoid copying the body if it was inline in the call to websocket_error_and_close_handler() as the temporary from message() would live long enough, but I guess that doesn't actually matter.

Copy link
Contributor

@michael-wb michael-wb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -9,7 +9,7 @@
* None.

### Breaking changes
* None.
* The websocket error codes `websocket_client_too_old`, `websocket_client_too_new`, and `websocket_protocol_mismatch` along with their C API constants were removed. These corresponded to errors the legacy C++ server could have sent, but the baas sync server never did. Any platform networking implementations that surfaced these errors can report a `websocket_fatal_error` instead if an unknown error occurs during the websocket handshake. If a client connects that is too old or too new, it will finish the websocket handshake and then receive an in-band sync `ERROR` message that will be handled by the sync error handler. [PR #7917](https://github.com/realm/realm-core/pull/7917)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's technically a breaking change, but I doubt any of the SDKs with platform networking care about this error (and I doubt they've ever seen it).

@jbreams jbreams merged commit 43d1a26 into master Jul 24, 2024
41 checks passed
@jbreams jbreams deleted the jbr/remove_websocket_too_new_old branch July 24, 2024 01:19
@github-actions github-actions bot mentioned this pull request Jul 25, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants