mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +01:00
Reset backoff before notifying of new state.
The new state may cause the poller to poll the plugin. Let's avoid a race between updating and querying the polling interval.
This commit is contained in:
@@ -233,7 +233,7 @@ abstract class BluetoothPlugin<SS> implements DuplexPlugin, EventListener {
|
|||||||
try {
|
try {
|
||||||
conn = acceptConnection(ss);
|
conn = acceptConnection(ss);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// This is expected when the socket is closed
|
// This is expected when the server socket is closed
|
||||||
LOG.info("Server socket closed");
|
LOG.info("Server socket closed");
|
||||||
state.clearServerSocket();
|
state.clearServerSocket();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -152,9 +152,9 @@ abstract class TcpPlugin implements DuplexPlugin {
|
|||||||
InetSocketAddress local =
|
InetSocketAddress local =
|
||||||
(InetSocketAddress) ss.getLocalSocketAddress();
|
(InetSocketAddress) ss.getLocalSocketAddress();
|
||||||
setLocalSocketAddress(local);
|
setLocalSocketAddress(local);
|
||||||
callback.pluginStateChanged(getState());
|
|
||||||
if (LOG.isLoggable(INFO))
|
if (LOG.isLoggable(INFO))
|
||||||
LOG.info("Listening on " + scrubSocketAddress(local));
|
LOG.info("Listening on " + scrubSocketAddress(local));
|
||||||
|
callback.pluginStateChanged(getState());
|
||||||
acceptContactConnections(ss);
|
acceptContactConnections(ss);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,8 +652,8 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
new TorTransportConnection(this, s));
|
new TorTransportConnection(this, s));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// This is expected when the socket is closed
|
// This is expected when the server socket is closed
|
||||||
if (LOG.isLoggable(INFO)) LOG.info(e.toString());
|
LOG.info("Rendezvous server socket closed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Map<Integer, String> portLines =
|
Map<Integer, String> portLines =
|
||||||
@@ -682,9 +682,9 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
public void circuitStatus(String status, String id, String path) {
|
public void circuitStatus(String status, String id, String path) {
|
||||||
if (status.equals("BUILT") &&
|
if (status.equals("BUILT") &&
|
||||||
state.getAndSetCircuitBuilt()) {
|
state.getAndSetCircuitBuilt()) {
|
||||||
callback.pluginStateChanged(getState());
|
|
||||||
LOG.info("First circuit built");
|
LOG.info("First circuit built");
|
||||||
backoff.reset();
|
backoff.reset();
|
||||||
|
callback.pluginStateChanged(getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,8 +716,8 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
if (LOG.isLoggable(INFO)) LOG.info(severity + " " + msg);
|
if (LOG.isLoggable(INFO)) LOG.info(severity + " " + msg);
|
||||||
if (severity.equals("NOTICE") && msg.startsWith("Bootstrapped 100%")) {
|
if (severity.equals("NOTICE") && msg.startsWith("Bootstrapped 100%")) {
|
||||||
state.setBootstrapped();
|
state.setBootstrapped();
|
||||||
callback.pluginStateChanged(getState());
|
|
||||||
backoff.reset();
|
backoff.reset();
|
||||||
|
callback.pluginStateChanged(getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user