diff --git a/app/src/main/java/com/limelight/preferences/AddComputerManually.java b/app/src/main/java/com/limelight/preferences/AddComputerManually.java index a9f30e67..982132b5 100644 --- a/app/src/main/java/com/limelight/preferences/AddComputerManually.java +++ b/app/src/main/java/com/limelight/preferences/AddComputerManually.java @@ -15,7 +15,9 @@ import com.limelight.computers.ComputerManagerService; import com.limelight.R; import com.limelight.nvstream.http.ComputerDetails; import com.limelight.nvstream.http.NvHTTP; +import com.limelight.nvstream.jni.MoonBridge; import com.limelight.utils.Dialog; +import com.limelight.utils.ServerHelper; import com.limelight.utils.SpinnerDialog; import com.limelight.utils.UiHelper; @@ -97,6 +99,7 @@ public class AddComputerManually extends Activity { private void doAddPc(String host) { boolean wrongSiteLocal = false; boolean success; + int portTestResult; SpinnerDialog dialog = SpinnerDialog.displayDialog(this, getResources().getString(R.string.title_add_pc), getResources().getString(R.string.msg_add_pc), false); @@ -114,6 +117,14 @@ public class AddComputerManually extends Activity { if (!success){ wrongSiteLocal = isWrongSubnetSiteLocalAddress(host); } + if (!success && !wrongSiteLocal) { + // Run the test before dismissing the spinner because it can take a few seconds. + portTestResult = MoonBridge.testClientConnectivity(ServerHelper.CONNECTION_TEST_SERVER, 443, + MoonBridge.ML_PORT_FLAG_TCP_47984 | MoonBridge.ML_PORT_FLAG_TCP_47989); + } else { + // Don't bother with the test if we succeeded or the IP address was bogus + portTestResult = MoonBridge.ML_TEST_RESULT_INCONCLUSIVE; + } dialog.dismiss(); @@ -121,7 +132,14 @@ public class AddComputerManually extends Activity { Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title), getResources().getString(R.string.addpc_wrong_sitelocal), false); } else if (!success) { - Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title), getResources().getString(R.string.addpc_fail), false); + String dialogText; + if (portTestResult != MoonBridge.ML_TEST_RESULT_INCONCLUSIVE && portTestResult != 0) { + dialogText = getResources().getString(R.string.nettest_text_blocked); + } + else { + dialogText = getResources().getString(R.string.addpc_fail); + } + Dialog.displayDialog(this, getResources().getString(R.string.conn_error_title), dialogText, false); } else { AddComputerManually.this.runOnUiThread(new Runnable() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6f6fac31..da4b268f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -30,8 +30,8 @@ Network Test Complete 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. The network test could not be performed. Please try again later. - 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 - Your device\'s current network connection is blocking Moonlight. Streaming over the Internet may not work properly while connected to this network. + Your device\'s current network connection seems to be blocking Moonlight. Streaming over the Internet may not work while connected to this network.\n\nThe following network ports were blocked:\n + Your device\'s current network connection is blocking Moonlight. Streaming over the Internet may not work while connected to this network. Pairing…