mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Nickname is all one word.
This commit is contained in:
@@ -25,7 +25,7 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(IdentityManagerImpl.class.getName());
|
||||
|
||||
// Make sure that this variable is immutable
|
||||
// The local author is immutable so we can cache it
|
||||
private volatile LocalAuthor cachedAuthor;
|
||||
|
||||
@Inject
|
||||
@@ -40,7 +40,7 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
txn.setComplete();
|
||||
cachedAuthor = localAuthor;
|
||||
LOG.info("Local Author created");
|
||||
LOG.info("Local author registered");
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
cachedAuthor = loadLocalAuthor(txn);
|
||||
LOG.info("Author loaded from db");
|
||||
LOG.info("Local author loaded");
|
||||
txn.setComplete();
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
@@ -66,6 +66,7 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
public LocalAuthor getLocalAuthor(Transaction txn) throws DbException {
|
||||
if (cachedAuthor == null) {
|
||||
cachedAuthor = loadLocalAuthor(txn);
|
||||
LOG.info("Local author loaded");
|
||||
}
|
||||
return cachedAuthor;
|
||||
}
|
||||
@@ -87,10 +88,7 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
@Override
|
||||
public Status getAuthorStatus(Transaction txn, AuthorId authorId)
|
||||
throws DbException {
|
||||
|
||||
// Compare to the IDs of the user's identity
|
||||
if (getLocalAuthor(txn).getId().equals(authorId)) return OURSELVES;
|
||||
|
||||
Collection<Contact> contacts = db.getContactsByAuthorId(txn, authorId);
|
||||
if (contacts.isEmpty()) return UNKNOWN;
|
||||
for (Contact c : contacts) {
|
||||
|
||||
@@ -305,8 +305,7 @@ class IntroduceeManager {
|
||||
boolean alice = comp < 0;
|
||||
|
||||
// get our local author
|
||||
LocalAuthor author =
|
||||
identityManager.getLocalAuthor(txn);
|
||||
LocalAuthor author = identityManager.getLocalAuthor(txn);
|
||||
|
||||
SecretKey secretKey;
|
||||
byte[] privateKeyBytes = localState.getRaw(OUR_PRIVATE_KEY);
|
||||
|
||||
@@ -93,7 +93,7 @@ class LifecycleManagerImpl implements LifecycleManager {
|
||||
.createLocalAuthor(nickname, publicKey, privateKey);
|
||||
long duration = System.currentTimeMillis() - now;
|
||||
if (LOG.isLoggable(INFO))
|
||||
LOG.info("Identity creation took " + duration + " ms");
|
||||
LOG.info("Creating local author took " + duration + " ms");
|
||||
return localAuthor;
|
||||
}
|
||||
|
||||
@@ -102,12 +102,11 @@ class LifecycleManagerImpl implements LifecycleManager {
|
||||
identityManager.registerLocalAuthor(author);
|
||||
long duration = System.currentTimeMillis() - now;
|
||||
if (LOG.isLoggable(INFO))
|
||||
LOG.info("Author registration took " + duration +
|
||||
" ms");
|
||||
LOG.info("Registering local author took " + duration + " ms");
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartResult startServices(@Nullable String authorNick) {
|
||||
public StartResult startServices(@Nullable String nickname) {
|
||||
if (!startStopSemaphore.tryAcquire()) {
|
||||
LOG.info("Already starting or stopping");
|
||||
return ALREADY_RUNNING;
|
||||
@@ -124,8 +123,8 @@ class LifecycleManagerImpl implements LifecycleManager {
|
||||
else LOG.info("Creating database took " + duration + " ms");
|
||||
}
|
||||
|
||||
if (authorNick != null) {
|
||||
registerLocalAuthor(createLocalAuthor(authorNick));
|
||||
if (nickname != null) {
|
||||
registerLocalAuthor(createLocalAuthor(nickname));
|
||||
}
|
||||
|
||||
dbLatch.countDown();
|
||||
|
||||
Reference in New Issue
Block a user