From 814557435d009352169530e8e625cadbb9dd2281 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 25 Feb 2015 19:54:35 -0500 Subject: [PATCH] Print a better message if attempting to quit another device's stream --- .../com/limelight/nvstream/NvConnection.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/moonlight-common/src/com/limelight/nvstream/NvConnection.java b/moonlight-common/src/com/limelight/nvstream/NvConnection.java index 416f1f27..e24205ef 100644 --- a/moonlight-common/src/com/limelight/nvstream/NvConnection.java +++ b/moonlight-common/src/com/limelight/nvstream/NvConnection.java @@ -185,12 +185,24 @@ public class NvConnection { protected boolean quitAndLaunch(NvHTTP h, NvApp app) throws IOException, XmlPullParserException { - if (!h.quitApp()) { - context.connListener.displayMessage("Failed to quit previous session! You must quit it manually"); - return false; - } else { - return launchNotRunningApp(h, app); + try { + if (!h.quitApp()) { + context.connListener.displayMessage("Failed to quit previous session! You must quit it manually"); + return false; + } + } catch (GfeHttpResponseException e) { + if (e.getErrorCode() == 599) { + context.connListener.displayMessage("This session wasn't started by this device," + + " so it cannot be quit. End streaming on the original " + + "device or the PC itself. (Error code: "+e.getErrorCode()+")"); + return false; + } + else { + throw e; + } } + + return launchNotRunningApp(h, app); } private boolean launchNotRunningApp(NvHTTP h, NvApp app)