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:
akwizgran
2020-01-16 13:01:41 +00:00
parent 549cf4e2be
commit 0aada89625
3 changed files with 6 additions and 6 deletions

View File

@@ -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;

View File

@@ -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);
});
}

View File

@@ -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());
}
}