From df4eabbf090eb84b433f8a1a5e3451f470f86226 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 9 Apr 2014 07:15:47 -0700 Subject: [PATCH] Don't choke on proxy detection if allow_offline = true. This unfortunately relies on _app.init() happening *inside* detect proxy in the particular code path that results in failed proxy detection. I wish app.init wasn't such a twisty maze of spaghetti, but that ship has long since sailed. --- .../java/com/threerings/getdown/data/Application.java | 8 ++++++++ .../java/com/threerings/getdown/launcher/Getdown.java | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/threerings/getdown/data/Application.java b/src/main/java/com/threerings/getdown/data/Application.java index bf4858a..ee7d43e 100644 --- a/src/main/java/com/threerings/getdown/data/Application.java +++ b/src/main/java/com/threerings/getdown/data/Application.java @@ -829,6 +829,14 @@ public class Application return _optimumJvmArgs != null; } + /** + * Returns true if the app should attempt to run even if we have no Internet connection. + */ + public boolean allowOffline () + { + return _allowOffline; + } + /** * Attempts to redownload the getdown.txt file based on information parsed from a * previous call to {@link #init}. diff --git a/src/main/java/com/threerings/getdown/launcher/Getdown.java b/src/main/java/com/threerings/getdown/launcher/Getdown.java index a02254f..d905e8f 100644 --- a/src/main/java/com/threerings/getdown/launcher/Getdown.java +++ b/src/main/java/com/threerings/getdown/launcher/Getdown.java @@ -162,7 +162,9 @@ public abstract class Getdown extends Thread try { _dead = false; - if (detectProxy()) { + // if we fail to detect a proxy, but we're allowed to run offline, then go ahead and + // run the app anyway because we're prepared to cope with not being able to update + if (detectProxy() || _app.allowOffline()) { getdown(); } else if (_silent) { log.warning("Need a proxy, but we don't want to bother anyone. Exiting.");