Add automatic network test for failed connection stages

This commit is contained in:
Cameron Gutman 2020-08-01 22:56:32 -07:00
parent ef72e3ef77
commit f361265d70
2 changed files with 22 additions and 7 deletions

View File

@ -1506,11 +1506,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
runOnUiThread(new Runnable() {
@Override
public void run() {
if (spinner != null) {
spinner.dismiss();
spinner = null;
}
if (!displayedFailureDialog) {
displayedFailureDialog = true;
LimeLog.severe(stage + " failed: " + errorCode);
@ -1520,8 +1515,27 @@ public class Game extends Activity implements SurfaceHolder.Callback,
Toast.makeText(Game.this, getResources().getText(R.string.video_decoder_init_failed), Toast.LENGTH_LONG).show();
}
Dialog.displayDialog(Game.this, getResources().getString(R.string.conn_error_title),
getResources().getString(R.string.conn_error_msg) + " " + stage +" (error "+errorCode+")", true);
String dialogText = getResources().getString(R.string.conn_error_msg) + " " + stage +" (error "+errorCode+")";
if (portFlags != 0) {
int ret = MoonBridge.testClientConnectivity("conntest-android.moonlight-stream.org", 443, portFlags);
if (ret != MoonBridge.ML_TEST_RESULT_INCONCLUSIVE && ret != 0) {
dialogText += "\n\n" + getResources().getString(R.string.nettest_text_blocked);
}
}
// testClientConnectivity() can take a little while, so leave the spinner dialog up until it's done
if (spinner != null) {
spinner.dismiss();
spinner = null;
}
Dialog.displayDialog(Game.this, getResources().getString(R.string.conn_error_title), dialogText, true);
}
else {
if (spinner != null) {
spinner.dismiss();
spinner = null;
}
}
}
});

View File

@ -31,6 +31,7 @@
<string name="nettest_text_success">Your network does not appear to be blocking Moonlight. If you still have trouble connecting, check your PC\'s firewall settings.\n\nIf you are trying to stream over the Internet, install the Moonlight Internet Hosting Tool on your PC and run the included Internet Streaming Tester to check your PC\'s Internet connection.</string>
<string name="nettest_text_inconclusive">The network test could not be performed. Please try again later.</string>
<string name="nettest_text_failure">Your device\'s current network connection seems to be blocking Moonlight. Streaming over the Internet may not work properly while connected to this network.\n\nThe following network ports were blocked:\n</string>
<string name="nettest_text_blocked">Your device\'s current network connection is blocking Moonlight. Streaming over the Internet may not work properly while connected to this network.</string>
<!-- Pair messages -->
<string name="pairing">Pairing…</string>