mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
cleanup
This commit is contained in:
@@ -19,7 +19,6 @@ class FortunaGenerator {
|
||||
private static final int KEY_BYTES = 32;
|
||||
private static final int BLOCK_BYTES = 16;
|
||||
|
||||
// All of the following are locking: this
|
||||
private final MessageDigest digest = new DoubleDigest(new SHA256Digest());
|
||||
private final BlockCipher cipher = new AESLightEngine();
|
||||
private final byte[] key = new byte[KEY_BYTES];
|
||||
|
||||
@@ -10,7 +10,7 @@ class SecretKeyImpl implements SecretKey {
|
||||
|
||||
private final byte[] key;
|
||||
|
||||
private boolean erased = false; // Locking: this
|
||||
private boolean erased = false;
|
||||
|
||||
private final Lock synchLock = new ReentrantLock();
|
||||
|
||||
|
||||
@@ -316,12 +316,12 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
private final Clock clock;
|
||||
|
||||
private final LinkedList<Connection> connections =
|
||||
new LinkedList<Connection>(); // Locking: self
|
||||
new LinkedList<Connection>();
|
||||
|
||||
private final AtomicInteger transactionCount = new AtomicInteger(0);
|
||||
|
||||
private int openConnections = 0; // Locking: connections
|
||||
private boolean closed = false; // Locking: connections
|
||||
private int openConnections = 0;
|
||||
private boolean closed = false;
|
||||
|
||||
protected abstract Connection createConnection() throws SQLException;
|
||||
protected abstract void flushBuffersToDisk(Statement s) throws SQLException;
|
||||
|
||||
@@ -65,10 +65,7 @@ class ConnectorGroup extends Thread implements InvitationTask {
|
||||
|
||||
private final Lock synchLock = new ReentrantLock();
|
||||
|
||||
/*
|
||||
* All of the following require locking: this. We don't want to call the
|
||||
* listeners with a lock held, but we need to avoid a race condition in
|
||||
* addListener(), so the state that's accessed in addListener() after
|
||||
/*The state that's accessed in addListener() after
|
||||
* calling listeners.add() must be guarded by a lock.
|
||||
*/
|
||||
private int localConfirmationCode = -1, remoteConfirmationCode = -1;
|
||||
|
||||
@@ -9,9 +9,9 @@ import org.briarproject.api.lifecycle.ShutdownManager;
|
||||
|
||||
class ShutdownManagerImpl implements ShutdownManager {
|
||||
|
||||
protected final Map<Integer, Thread> hooks; // Locking: this
|
||||
protected final Map<Integer, Thread> hooks;
|
||||
|
||||
private int nextHandle = 0; // Locking: this
|
||||
private int nextHandle = 0;
|
||||
|
||||
private final Lock synchLock = new ReentrantLock();
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ class Receiver implements ReadHandler {
|
||||
|
||||
private final Clock clock;
|
||||
private final Sender sender;
|
||||
private final SortedSet<Data> dataFrames; // Locking: this
|
||||
private final SortedSet<Data> dataFrames;
|
||||
|
||||
private int windowSize = MAX_WINDOW_SIZE; // Locking: this
|
||||
private int windowSize = MAX_WINDOW_SIZE;
|
||||
private long finalSequenceNumber = Long.MAX_VALUE;
|
||||
private long nextSequenceNumber = 1;
|
||||
|
||||
|
||||
@@ -25,9 +25,8 @@ class Sender {
|
||||
|
||||
private final Clock clock;
|
||||
private final WriteHandler writeHandler;
|
||||
private final LinkedList<Outstanding> outstanding; // Locking: this
|
||||
private final LinkedList<Outstanding> outstanding;
|
||||
|
||||
// All of the following are locking: this
|
||||
private int outstandingBytes = 0;
|
||||
private int windowSize = Data.MAX_PAYLOAD_LENGTH;
|
||||
private int rtt = INITIAL_RTT, rttVar = INITIAL_RTT_VAR;
|
||||
|
||||
@@ -52,7 +52,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
private final Clock clock;
|
||||
private final Timer timer;
|
||||
|
||||
// All of the following are locking: this
|
||||
private final Map<TransportId, Long> maxLatencies;
|
||||
private final Map<EndpointKey, TemporarySecret> oldSecrets;
|
||||
private final Map<EndpointKey, TemporarySecret> currentSecrets;
|
||||
@@ -120,7 +119,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
}
|
||||
|
||||
// Assigns secrets to the appropriate maps and returns any dead secrets
|
||||
// Locking: this
|
||||
private Collection<TemporarySecret> assignSecretsToMaps(long now,
|
||||
Collection<TemporarySecret> secrets) {
|
||||
Collection<TemporarySecret> dead = new ArrayList<TemporarySecret>();
|
||||
@@ -154,7 +152,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
}
|
||||
|
||||
// Replaces and erases the given secrets and returns any secrets created
|
||||
// Locking: this
|
||||
private Collection<TemporarySecret> replaceDeadSecrets(long now,
|
||||
Collection<TemporarySecret> dead) {
|
||||
// If there are several dead secrets for an endpoint, use the newest
|
||||
@@ -242,7 +239,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
// Locking: this
|
||||
private void removeAndEraseSecrets(Map<?, TemporarySecret> m) {
|
||||
for(TemporarySecret s : m.values()) ByteUtils.erase(s.getSecret());
|
||||
m.clear();
|
||||
@@ -374,7 +370,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
// Locking: this
|
||||
private void removeAndEraseSecrets(ContactId c, Map<?, TemporarySecret> m) {
|
||||
Iterator<TemporarySecret> it = m.values().iterator();
|
||||
while(it.hasNext()) {
|
||||
@@ -386,7 +381,6 @@ class KeyManagerImpl extends TimerTask implements KeyManager, EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
// Locking: this
|
||||
private void removeAndEraseSecrets(TransportId t,
|
||||
Map<?, TemporarySecret> m) {
|
||||
Iterator<TemporarySecret> it = m.values().iterator();
|
||||
|
||||
@@ -20,7 +20,7 @@ class TagRecogniserImpl implements TagRecogniser {
|
||||
|
||||
private final CryptoComponent crypto;
|
||||
private final DatabaseComponent db;
|
||||
// Locking: this
|
||||
|
||||
private final Map<TransportId, TransportTagRecogniser> recognisers;
|
||||
|
||||
private final Lock synchLock = new ReentrantLock();
|
||||
|
||||
@@ -29,8 +29,8 @@ class TransportTagRecogniser {
|
||||
private final CryptoComponent crypto;
|
||||
private final DatabaseComponent db;
|
||||
private final TransportId transportId;
|
||||
private final Map<Bytes, TagContext> tagMap; // Locking: this
|
||||
private final Map<RemovalKey, RemovalContext> removalMap; // Locking: this
|
||||
private final Map<Bytes, TagContext> tagMap;
|
||||
private final Map<RemovalKey, RemovalContext> removalMap;
|
||||
|
||||
private final Lock synchLock = new ReentrantLock();
|
||||
|
||||
@@ -119,7 +119,6 @@ class TransportTagRecogniser {
|
||||
}
|
||||
}
|
||||
|
||||
// Locking: this
|
||||
private void removeSecret(RemovalContext r) {
|
||||
// Remove the expected tags
|
||||
SecretKey key = crypto.deriveTagKey(r.secret, !r.alice);
|
||||
|
||||
Reference in New Issue
Block a user