diff --git a/app/src/main/java/com/limelight/Game.java b/app/src/main/java/com/limelight/Game.java index 42200663..aa9d6457 100644 --- a/app/src/main/java/com/limelight/Game.java +++ b/app/src/main/java/com/limelight/Game.java @@ -1527,9 +1527,18 @@ public class Game extends Activity implements SurfaceHolder.Callback, @Override public void stageFailed(final String stage, final int portFlags, 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, portFlags); + runOnUiThread(new Runnable() { @Override public void run() { + if (spinner != null) { + spinner.dismiss(); + spinner = null; + } + if (!displayedFailureDialog) { displayedFailureDialog = true; LimeLog.severe(stage + " failed: " + errorCode); @@ -1540,33 +1549,24 @@ public class Game extends Activity implements SurfaceHolder.Callback, } String dialogText = getResources().getString(R.string.conn_error_msg) + " " + stage +" (error "+errorCode+")"; - if (portFlags != 0) { - int ret = MoonBridge.testClientConnectivity(ServerHelper.CONNECTION_TEST_SERVER, 443, portFlags); - if (ret != MoonBridge.ML_TEST_RESULT_INCONCLUSIVE && ret != 0) { - dialogText += "\n\n" + getResources().getString(R.string.nettest_text_blocked); - } + if (portTestResult != MoonBridge.ML_TEST_RESULT_INCONCLUSIVE && portTestResult != 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; - } - } } }); } @Override 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)); + runOnUiThread(new Runnable() { @Override public void run() { @@ -1586,16 +1586,6 @@ public class Game extends Activity implements SurfaceHolder.Callback, if (errorCode != MoonBridge.ML_ERROR_GRACEFUL_TERMINATION) { String message; - // Perform a connection test if the failure could be due to a blocked port - int portFlags = MoonBridge.getPortFlagsFromTerminationErrorCode(errorCode); - int portTestResult; - if (portFlags != 0) { - portTestResult = MoonBridge.testClientConnectivity(ServerHelper.CONNECTION_TEST_SERVER, 443, portFlags); - } - else { - portTestResult = MoonBridge.ML_TEST_RESULT_INCONCLUSIVE; - } - if (portTestResult != MoonBridge.ML_TEST_RESULT_INCONCLUSIVE && portTestResult != 0) { // If we got a blocked result, that supersedes any other error message message = getResources().getString(R.string.nettest_text_blocked); diff --git a/app/src/main/jni/moonlight-core/moonlight-common-c b/app/src/main/jni/moonlight-core/moonlight-common-c index 2fdcfb94..f2c1d03d 160000 --- a/app/src/main/jni/moonlight-core/moonlight-common-c +++ b/app/src/main/jni/moonlight-core/moonlight-common-c @@ -1 +1 @@ -Subproject commit 2fdcfb9429be64842d2a730801d2b5700d40d7b9 +Subproject commit f2c1d03d8e268375de00352a1228a5669b016b61