Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Conversation

@gkassabli
Copy link
Contributor

Description

We didn't have any specific handling for disconnect on mobile. Whenever the server was killed, mobile client worker is going to get to weird stale state where it doesn't technically hang, but nothing was happening and the client wasn't interactive.
This PR adds the code to restore Playground to "Ready to connect" mode

Tests

Run Playground locally and ensure that when server is disconnected we are ready to connect again ->
After the server is back, we should be able to reconnect

Documentation

Primary reviewers

@improbable-prow-robot improbable-prow-robot added the size/M Denotes a PR that changes 40-149 lines, ignoring generated files. label Jan 16, 2019
@gkassabli gkassabli changed the base branch from master to feature/mobile-clients-fix January 16, 2019 16:43
@improbable-prow-robot improbable-prow-robot added size/S Denotes a PR that changes 15-39 lines, ignoring generated files. and removed size/M Denotes a PR that changes 40-149 lines, ignoring generated files. labels Jan 16, 2019
@jamiebrynes7
Copy link
Contributor

What's up with the branch target?

}

// Disable system after first run.
Enabled = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't related to PR, but I think this was missing here. The code in the system isn't really intended to be ran multiple times

Copy link
Contributor

Choose a reason for hiding this comment

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

this might disable the system before it is actually run depending on when the components are added to the entities

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. This should be fixed if moved to the cycle above, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah if its in the for loop it should be good 👍



private void OnDisconnected(string reason)
protected virtual void OnDisconnected(string reason)
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of making this protected, just register to the event directly on the worker:

e.g. Worker.OnDisconnect +=ConnectionScreenController.OnDisconnected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense

@gkassabli
Copy link
Contributor Author

@jamiebrynes7 this is temporary to exclude unrelated code in mobile-clients-fix branch until it lands. Will be switched to master then


protected override void OnDestroyManager()
{
UnityEngine.Object.Destroy(UIComponent.Main.gameObject);
Copy link
Contributor

Choose a reason for hiding this comment

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

use the UnityObjectDestroyer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, didn't know about that one. Not related, but I am curious whey do we use DestoyImmediate in tests

@gkassabli gkassabli force-pushed the feature/mobile-clients-fix branch from 2d253eb to 03c71a4 Compare January 16, 2019 17:00
@jamiebrynes7 jamiebrynes7 added T: enhancement Type: This is an improvement to an existing feature A: playground Area: Playground labels Jan 16, 2019
@gkassabli gkassabli changed the base branch from feature/mobile-clients-fix to master January 16, 2019 17:24
@improbable-prow-robot improbable-prow-robot added size/M Denotes a PR that changes 40-149 lines, ignoring generated files. and removed size/S Denotes a PR that changes 15-39 lines, ignoring generated files. labels Jan 16, 2019
@gkassabli gkassabli force-pushed the feature/playground_disconnect branch from 202a7c1 to da603ef Compare January 16, 2019 17:26
@improbable-prow-robot improbable-prow-robot added size/S Denotes a PR that changes 15-39 lines, ignoring generated files. and removed size/M Denotes a PR that changes 40-149 lines, ignoring generated files. labels Jan 16, 2019
@jessicafalk
Copy link
Contributor

Tested on an iOS device by connecting to a local device and then turning off the Wifi on the phone. Didn't seem to work

@jessicafalk jessicafalk reopened this Jan 17, 2019
@gkassabli gkassabli force-pushed the feature/playground_disconnect branch 2 times, most recently from a5b2923 to 0781e2f Compare January 21, 2019 12:05
@gkassabli
Copy link
Contributor Author

Verified this works as expected with KCP on master.

Copy link
Contributor

@jamiebrynes7 jamiebrynes7 left a comment

Choose a reason for hiding this comment

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

LGTM. To check - if you try to reconnect, does everything work as normal?

Copy link
Contributor

@jessicafalk jessicafalk left a comment

Choose a reason for hiding this comment

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

tested on my side as well

@gkassabli
Copy link
Contributor Author

LGTM. To check - if you try to reconnect, does everything work as normal?

Yup, after enabling connection back reconnect works as expected

@gkassabli gkassabli force-pushed the feature/playground_disconnect branch from 32829b0 to e2f16f0 Compare January 21, 2019 18:11
@gkassabli gkassabli force-pushed the feature/playground_disconnect branch from e2f16f0 to 761e0ae Compare January 22, 2019 11:06
@gkassabli gkassabli merged commit 6921b8e into master Jan 22, 2019
@gkassabli gkassabli deleted the feature/playground_disconnect branch January 22, 2019 13:12
jessicafalk pushed a commit that referenced this pull request Nov 15, 2019
jessicafalk pushed a commit that referenced this pull request Nov 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A: playground Area: Playground size/S Denotes a PR that changes 15-39 lines, ignoring generated files. T: enhancement Type: This is an improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants