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

Two bugs; one commit #32

Closed
wants to merge 3 commits into from
Closed

Two bugs; one commit #32

wants to merge 3 commits into from

Conversation

bmeike
Copy link
Contributor

@bmeike bmeike commented Sep 24, 2021

This is fixes for:
CBL-2389 | Confirm LiteCore request for close, before connection is opened.
CBL-2395 | Kotlin FullTextIndexConfiguration?.create extension function does not support multiple expressions

@bmeike
Copy link
Contributor Author

bmeike commented Sep 24, 2021

Please note: A complete fix for the root problem would, as noted in the related CBSE, require a timeout on silent connections. Since that scenario is quite unlikely, and introducing a timer into sensitive code is a significant change, I am not going to do it. The fix simply addresses the case in which the Core closes a connection that is not yet open.

@bmeike
Copy link
Contributor Author

bmeike commented Sep 24, 2021

Also note that it is quite difficult to write a dev test to confirm that this fix works: I have not added one.

I will have to set up a test network to try this out, probably using Jim's net-breaking proxy. Will confirm results as soon as I have them.

It should be relatively easy for QE to test this scenario. I hope that they will add such a test.

@pasin
Copy link
Contributor

pasin commented Sep 24, 2021

I think OKHTTP might already have connection timeout.

@@ -175,7 +184,10 @@ public void onMessage(@NonNull WebSocket webSocket, @NonNull ByteString bytes) {
public void onClosing(@NonNull WebSocket webSocket, int code, @NonNull String reason) {
Log.d(TAG, "%s#OkHTTP closing: %s", AbstractCBLWebSocket.this, reason);
synchronized (getPeerLock()) {
if (!state.setState(State.CLOSE_REQUESTED)) { return; }
if (!state.setState(State.CLOSE_REQUESTED)) {
if (state.assertState(State.CLOSED)) { webSocket.cancel(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

I couldn't think about the case that the state is already CLOSED while OKHTTP is closing. However it doesn't hurt to put the logic here for precaution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants