mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 21:59:54 +01:00
Allow read-only transaction when not marking message as sent.
This commit is contained in:
@@ -492,6 +492,8 @@ public interface DatabaseComponent extends TransactionManager {
|
|||||||
* Returns the message with the given ID for transmission to the given
|
* Returns the message with the given ID for transmission to the given
|
||||||
* contact over a transport with the given maximum latency. Returns null
|
* contact over a transport with the given maximum latency. Returns null
|
||||||
* if the message is no longer visible to the contact.
|
* if the message is no longer visible to the contact.
|
||||||
|
* <p/>
|
||||||
|
* Read-only if {@code markAsSent} is false.
|
||||||
*
|
*
|
||||||
* @param markAsSent True if the message should be marked as sent.
|
* @param markAsSent True if the message should be marked as sent.
|
||||||
* If false it can be marked as sent by calling
|
* If false it can be marked as sent by calling
|
||||||
|
|||||||
@@ -746,7 +746,9 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
public Message getMessageToSend(Transaction transaction, ContactId c,
|
public Message getMessageToSend(Transaction transaction, ContactId c,
|
||||||
MessageId m, long maxLatency, boolean markAsSent)
|
MessageId m, long maxLatency, boolean markAsSent)
|
||||||
throws DbException {
|
throws DbException {
|
||||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
if (markAsSent && transaction.isReadOnly()) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
T txn = unbox(transaction);
|
T txn = unbox(transaction);
|
||||||
if (!db.containsContact(txn, c))
|
if (!db.containsContact(txn, c))
|
||||||
throw new NoSuchContactException();
|
throw new NoSuchContactException();
|
||||||
|
|||||||
Reference in New Issue
Block a user