mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Don't show Tor in the enabling state if it's disabled by settings.
This commit is contained in:
@@ -191,7 +191,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
@Override
|
@Override
|
||||||
public void start() throws PluginException {
|
public void start() throws PluginException {
|
||||||
if (used.getAndSet(true)) throw new IllegalStateException();
|
if (used.getAndSet(true)) throw new IllegalStateException();
|
||||||
state.setStarted();
|
|
||||||
if (!torDirectory.exists()) {
|
if (!torDirectory.exists()) {
|
||||||
if (!torDirectory.mkdirs()) {
|
if (!torDirectory.mkdirs()) {
|
||||||
LOG.warning("Could not create Tor directory.");
|
LOG.warning("Could not create Tor directory.");
|
||||||
@@ -279,7 +278,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new PluginException(e);
|
throw new PluginException(e);
|
||||||
}
|
}
|
||||||
state.setTorStarted();
|
state.setStarted();
|
||||||
// Check whether we're online
|
// Check whether we're online
|
||||||
updateConnectionStatus(networkManager.getNetworkStatus(),
|
updateConnectionStatus(networkManager.getNetworkStatus(),
|
||||||
batteryManager.isCharging());
|
batteryManager.isCharging());
|
||||||
@@ -863,7 +862,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private boolean started = false,
|
private boolean started = false,
|
||||||
stopped = false,
|
stopped = false,
|
||||||
torStarted = false,
|
|
||||||
networkInitialised = false,
|
networkInitialised = false,
|
||||||
networkEnabled = false,
|
networkEnabled = false,
|
||||||
bootstrapped = false,
|
bootstrapped = false,
|
||||||
@@ -882,13 +880,8 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
callback.pluginStateChanged(getState());
|
callback.pluginStateChanged(getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Doesn't affect getState()
|
|
||||||
synchronized void setTorStarted() {
|
|
||||||
torStarted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized boolean isTorRunning() {
|
synchronized boolean isTorRunning() {
|
||||||
return torStarted && !stopped;
|
return started && !stopped;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
Reference in New Issue
Block a user