mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +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;
|
||||||
|
|||||||
@@ -952,6 +952,8 @@ DatabaseCleaner.Callback {
|
|||||||
public Collection<GroupMessageHeader> getMessageHeaders(GroupId g)
|
public Collection<GroupMessageHeader> getMessageHeaders(GroupId g)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
messageLock.readLock().lock();
|
messageLock.readLock().lock();
|
||||||
|
try {
|
||||||
|
ratingLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
subscriptionLock.readLock().lock();
|
subscriptionLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
@@ -970,6 +972,9 @@ DatabaseCleaner.Callback {
|
|||||||
} finally {
|
} finally {
|
||||||
subscriptionLock.readLock().unlock();
|
subscriptionLock.readLock().unlock();
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
ratingLock.readLock().unlock();
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
messageLock.readLock().unlock();
|
messageLock.readLock().unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user