mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +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 {
|
||||
conn = acceptConnection(ss);
|
||||
} 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");
|
||||
state.clearServerSocket();
|
||||
return;
|
||||
|
||||
@@ -152,9 +152,9 @@ abstract class TcpPlugin implements DuplexPlugin {
|
||||
InetSocketAddress local =
|
||||
(InetSocketAddress) ss.getLocalSocketAddress();
|
||||
setLocalSocketAddress(local);
|
||||
callback.pluginStateChanged(getState());
|
||||
if (LOG.isLoggable(INFO))
|
||||
LOG.info("Listening on " + scrubSocketAddress(local));
|
||||
callback.pluginStateChanged(getState());
|
||||
acceptContactConnections(ss);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -652,8 +652,8 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
new TorTransportConnection(this, s));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// This is expected when the socket is closed
|
||||
if (LOG.isLoggable(INFO)) LOG.info(e.toString());
|
||||
// This is expected when the server socket is closed
|
||||
LOG.info("Rendezvous server socket closed");
|
||||
}
|
||||
});
|
||||
Map<Integer, String> portLines =
|
||||
@@ -682,9 +682,9 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
public void circuitStatus(String status, String id, String path) {
|
||||
if (status.equals("BUILT") &&
|
||||
state.getAndSetCircuitBuilt()) {
|
||||
callback.pluginStateChanged(getState());
|
||||
LOG.info("First circuit built");
|
||||
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 (severity.equals("NOTICE") && msg.startsWith("Bootstrapped 100%")) {
|
||||
state.setBootstrapped();
|
||||
callback.pluginStateChanged(getState());
|
||||
backoff.reset();
|
||||
callback.pluginStateChanged(getState());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user