mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +01:00
Set status to ENABLING when not connected to any guards/bridges.
This commit is contained in:
@@ -1071,7 +1071,8 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
if (reasonsDisabled != 0) return DISABLED;
|
if (reasonsDisabled != 0) return DISABLED;
|
||||||
if (!networkInitialised) return ENABLING;
|
if (!networkInitialised) return ENABLING;
|
||||||
if (!networkEnabled) return INACTIVE;
|
if (!networkEnabled) return INACTIVE;
|
||||||
return bootstrapped && circuitBuilt ? ACTIVE : ENABLING;
|
return bootstrapped && circuitBuilt && orConnectionsConnected > 0
|
||||||
|
? ACTIVE : ENABLING;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized int getReasonsDisabled() {
|
private synchronized int getReasonsDisabled() {
|
||||||
@@ -1098,17 +1099,23 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
LOG.warning("Count was zero before connection connected");
|
LOG.warning("Count was zero before connection connected");
|
||||||
orConnectionsPending = 0;
|
orConnectionsPending = 0;
|
||||||
}
|
}
|
||||||
|
int oldConnected = orConnectionsConnected;
|
||||||
orConnectionsConnected++;
|
orConnectionsConnected++;
|
||||||
logOrConnections();
|
logOrConnections();
|
||||||
|
if (oldConnected == 0) callback.pluginStateChanged(getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void onOrConnectionClosed() {
|
private synchronized void onOrConnectionClosed() {
|
||||||
|
int oldConnected = orConnectionsConnected;
|
||||||
orConnectionsConnected--;
|
orConnectionsConnected--;
|
||||||
if (orConnectionsConnected < 0) {
|
if (orConnectionsConnected < 0) {
|
||||||
LOG.warning("Count was zero before connection closed");
|
LOG.warning("Count was zero before connection closed");
|
||||||
orConnectionsConnected = 0;
|
orConnectionsConnected = 0;
|
||||||
}
|
}
|
||||||
logOrConnections();
|
logOrConnections();
|
||||||
|
if (orConnectionsConnected == 0 && oldConnected != 0) {
|
||||||
|
callback.pluginStateChanged(getState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void onSwitchingGuardContext() {
|
private synchronized void onSwitchingGuardContext() {
|
||||||
|
|||||||
Reference in New Issue
Block a user