mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-16 22:01:14 +00:00
Test network when the connection terminates due to lack of video traffic
This commit is contained in:
@@ -1586,14 +1586,30 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
if (errorCode != MoonBridge.ML_ERROR_GRACEFUL_TERMINATION) {
|
if (errorCode != MoonBridge.ML_ERROR_GRACEFUL_TERMINATION) {
|
||||||
String message;
|
String message;
|
||||||
|
|
||||||
switch (errorCode) {
|
// Perform a connection test if the failure could be due to a blocked port
|
||||||
case MoonBridge.ML_ERROR_NO_VIDEO_TRAFFIC:
|
int portFlags = MoonBridge.getPortFlagsFromTerminationErrorCode(errorCode);
|
||||||
message = getResources().getString(R.string.no_video_received_error);
|
int portTestResult;
|
||||||
break;
|
if (portFlags != 0) {
|
||||||
|
portTestResult = MoonBridge.testClientConnectivity(ServerHelper.CONNECTION_TEST_SERVER, 443, portFlags);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
portTestResult = MoonBridge.ML_TEST_RESULT_INCONCLUSIVE;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
if (portTestResult != MoonBridge.ML_TEST_RESULT_INCONCLUSIVE && portTestResult != 0) {
|
||||||
message = getResources().getString(R.string.conn_terminated_msg);
|
// If we got a blocked result, that supersedes any other error message
|
||||||
break;
|
message = getResources().getString(R.string.nettest_text_blocked);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (errorCode) {
|
||||||
|
case MoonBridge.ML_ERROR_NO_VIDEO_TRAFFIC:
|
||||||
|
message = getResources().getString(R.string.no_video_received_error);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
message = getResources().getString(R.string.conn_terminated_msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog.displayDialog(Game.this, getResources().getString(R.string.conn_terminated_title),
|
Dialog.displayDialog(Game.this, getResources().getString(R.string.conn_terminated_title),
|
||||||
|
|||||||
@@ -298,5 +298,7 @@ public class MoonBridge {
|
|||||||
|
|
||||||
public static native int getPortFlagsFromStage(int stage);
|
public static native int getPortFlagsFromStage(int stage);
|
||||||
|
|
||||||
|
public static native int getPortFlagsFromTerminationErrorCode(int errorCode);
|
||||||
|
|
||||||
public static native void init();
|
public static native void init();
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule app/src/main/jni/moonlight-core/moonlight-common-c updated: 6010367637...2fdcfb9429
@@ -130,3 +130,8 @@ JNIEXPORT jint JNICALL
|
|||||||
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromStage(JNIEnv *env, jclass clazz, jint stage) {
|
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromStage(JNIEnv *env, jclass clazz, jint stage) {
|
||||||
return LiGetPortFlagsFromStage(stage);
|
return LiGetPortFlagsFromStage(stage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jint JNICALL
|
||||||
|
Java_com_limelight_nvstream_jni_MoonBridge_getPortFlagsFromTerminationErrorCode(JNIEnv *env, jclass clazz, jint errorCode) {
|
||||||
|
return LiGetPortFlagsFromTerminationErrorCode(errorCode);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user