mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-04 06:56:06 +00:00
Display failing ports when the connection is unsuccessful
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user