mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Getting group message headers requires acquiring rating lock.
This commit is contained in:
@@ -277,7 +277,7 @@ interface Database<T> {
|
|||||||
/**
|
/**
|
||||||
* Returns the headers of all messages in the given group.
|
* Returns the headers of all messages in the given group.
|
||||||
* <p>
|
* <p>
|
||||||
* Locking: message read.
|
* Locking: message read, rating read.
|
||||||
*/
|
*/
|
||||||
Collection<GroupMessageHeader> getMessageHeaders(T txn, GroupId g)
|
Collection<GroupMessageHeader> getMessageHeaders(T txn, GroupId g)
|
||||||
throws DbException;
|
throws DbException;
|
||||||
|
|||||||
@@ -953,22 +953,27 @@ DatabaseCleaner.Callback {
|
|||||||
throws DbException {
|
throws DbException {
|
||||||
messageLock.readLock().lock();
|
messageLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
subscriptionLock.readLock().lock();
|
ratingLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
T txn = db.startTransaction();
|
subscriptionLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
if(!db.containsSubscription(txn, g))
|
T txn = db.startTransaction();
|
||||||
throw new NoSuchSubscriptionException();
|
try {
|
||||||
Collection<GroupMessageHeader> headers =
|
if(!db.containsSubscription(txn, g))
|
||||||
db.getMessageHeaders(txn, g);
|
throw new NoSuchSubscriptionException();
|
||||||
db.commitTransaction(txn);
|
Collection<GroupMessageHeader> headers =
|
||||||
return headers;
|
db.getMessageHeaders(txn, g);
|
||||||
} catch(DbException e) {
|
db.commitTransaction(txn);
|
||||||
db.abortTransaction(txn);
|
return headers;
|
||||||
throw e;
|
} catch(DbException e) {
|
||||||
|
db.abortTransaction(txn);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
subscriptionLock.readLock().unlock();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
subscriptionLock.readLock().unlock();
|
ratingLock.readLock().unlock();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
messageLock.readLock().unlock();
|
messageLock.readLock().unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user