Display failing ports when the connection is unsuccessful

This commit is contained in:
Cameron Gutman 2020-12-23 14:30:24 -06:00
parent 7b26852a1f
commit 7cc7953879
2 changed files with 15 additions and 4 deletions

View File

@ -1549,11 +1549,16 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
String dialogText = getResources().getString(R.string.conn_error_msg) + " " + stage +" (error "+errorCode+")";
if (portFlags != 0) {
dialogText += "\n\n" + getResources().getString(R.string.check_ports_msg) + "\n" +
MoonBridge.stringifyPortFlags(portFlags, "\n");
}
if (portTestResult != MoonBridge.ML_TEST_RESULT_INCONCLUSIVE && portTestResult != 0) {
dialogText += "\n\n" + getResources().getString(R.string.nettest_text_blocked);
}
Dialog.displayDialog(Game.this, getResources().getString(R.string.conn_error_title), dialogText, true);
}
}
@ -1564,8 +1569,8 @@ public class Game extends Activity implements SurfaceHolder.Callback,
public void connectionTerminated(final int errorCode) {
// Perform a connection test if the failure could be due to a blocked port
// This does network I/O, so don't do it on the main thread.
final int portTestResult = MoonBridge.testClientConnectivity(ServerHelper.CONNECTION_TEST_SERVER,
443, MoonBridge.getPortFlagsFromTerminationErrorCode(errorCode));
final int portFlags = MoonBridge.getPortFlagsFromTerminationErrorCode(errorCode);
final int portTestResult = MoonBridge.testClientConnectivity(ServerHelper.CONNECTION_TEST_SERVER,443, portFlags);
runOnUiThread(new Runnable() {
@Override
@ -1606,6 +1611,11 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
}
if (portFlags != 0) {
message += "\n\n" + getResources().getString(R.string.check_ports_msg) + "\n" +
MoonBridge.stringifyPortFlags(portFlags, "\n");
}
Dialog.displayDialog(Game.this, getResources().getString(R.string.conn_terminated_title),
message, true);
}

View File

@ -74,8 +74,9 @@
<string name="error_usb_prohibited">USB access is prohibited by your device administrator. Check your Knox or MDM settings.</string>
<string name="unable_to_pin_shortcut">Your current launcher does not allow for creating pinned shortcuts.</string>
<string name="video_decoder_init_failed">Video decoder failed to initialize. Your device may not support the selected resolution or frame rate.</string>
<string name="no_video_received_error">No video received from host. Check the host PC\'s firewall and port forwarding rules.</string>
<string name="no_video_received_error">No video received from host.</string>
<string name="no_frame_received_error">Your network connection isn\'t performing well. Reduce your video bitrate setting or try a faster connection.</string>
<string name="check_ports_msg">Check your firewall and port forwarding rules for port(s):</string>
<!-- Start application messages -->
<string name="conn_establishing_title">Establishing Connection</string>