diff --git a/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java b/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java index 1916d08aff7da796e398cdc7672e97c0ee2865e5..7ac2f539467c6dde55df7f519097ab9cb8902c13 100644 --- a/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java +++ b/briar-android/src/org/briarproject/plugins/tor/TorPlugin.java @@ -138,8 +138,6 @@ class TorPlugin implements DuplexPlugin, EventHandler { controlSocket.close(); killZombieProcess(); startProcess = true; - } else { - bootstrapped = true; } } catch(IOException e) { LOG.info("Tor is not running"); @@ -220,6 +218,14 @@ class TorPlugin implements DuplexPlugin, EventHandler { // Register to receive events from the Tor process controlConnection.setEventHandler(this); controlConnection.setEvents(Arrays.asList(EVENTS)); + // If Tor was already running, find out whether it's bootstrapped + if(!startProcess) { + String phase = controlConnection.getInfo("status/bootstrap-phase"); + if(phase != null && phase.contains("PROGRESS=100")) { + LOG.info("Tor has already bootstrapped"); + bootstrapped = true; + } + } // Register to receive network status events networkStateReceiver = new NetworkStateReceiver(); IntentFilter filter = new IntentFilter(CONNECTIVITY_ACTION);