diff --git a/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java b/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java index a700830caaa5b0524dd6f0c14587107b5d9dc9fd..7cb0be2995ec1eced8f65f7bc3e71b659805085b 100644 --- a/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java +++ b/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java @@ -108,7 +108,7 @@ class TorPlugin implements DuplexPlugin, EventHandler { configFile = new File(torDirectory, "torrc"); doneFile = new File(torDirectory, "done"); cookieFile = new File(torDirectory, ".tor/control_auth_cookie"); - hostnameFile = new File(torDirectory, "hostname"); + hostnameFile = new File(torDirectory, "hs/hostname"); circuitBuilt = new AtomicBoolean(false); } @@ -140,7 +140,7 @@ class TorPlugin implements DuplexPlugin, EventHandler { } // Install the GeoIP database and config file if necessary if (!isConfigInstalled() && !installConfig()) { - LOG.info("Could not install Tor config"); + LOG.warning("Could not install Tor config"); return false; } LOG.info("Starting Tor"); @@ -354,6 +354,7 @@ class TorPlugin implements DuplexPlugin, EventHandler { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); tryToClose(ss); + return; } if (!running) { tryToClose(ss); @@ -391,14 +392,15 @@ class TorPlugin implements DuplexPlugin, EventHandler { LOG.info("Creating hidden service"); try { // Watch for the hostname file being created/updated - hostnameFile.getParentFile().mkdirs(); + File serviceDirectory = hostnameFile.getParentFile(); + serviceDirectory.mkdirs(); hostnameFile.createNewFile(); CountDownLatch latch = new CountDownLatch(1); FileObserver obs = new WriteObserver(hostnameFile, latch); obs.startWatching(); // Use the control connection to update the Tor config List<String> config = Arrays.asList( - "HiddenServiceDir " + torDirectory.getAbsolutePath(), + "HiddenServiceDir " + serviceDirectory.getAbsolutePath(), "HiddenServicePort 80 127.0.0.1:" + port); controlConnection.setConf(config); controlConnection.saveConf();