mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
When a message is shared, share its transitive dependencies
Like other recursive operations on the dependency graph, this is not done in a single transaction to prevent an attacker from creating arbitrary large transactions. So at startup, the `ValidationManager` finds and resumes any unfinished operations, by looking for shared messages with unshared dependencies.
This commit is contained in:
@@ -68,12 +68,6 @@ public interface ClientHelper {
|
||||
void mergeMessageMetadata(Transaction txn, MessageId m,
|
||||
BdfDictionary metadata) throws DbException, FormatException;
|
||||
|
||||
/**
|
||||
* Marks the given message as shared or unshared with other contacts.
|
||||
*/
|
||||
void setMessageShared(Transaction txn, MessageId m, boolean shared)
|
||||
throws DbException;
|
||||
|
||||
byte[] toByteArray(BdfDictionary dictionary) throws FormatException;
|
||||
|
||||
byte[] toByteArray(BdfList list) throws FormatException;
|
||||
|
||||
@@ -258,6 +258,15 @@ public interface DatabaseComponent {
|
||||
Collection<MessageId> getPendingMessages(Transaction txn, ClientId c)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the IDs of any messages from the given client
|
||||
* that have a shared dependent, but are still not shared themselves.
|
||||
* <p/>
|
||||
* Read-only.
|
||||
*/
|
||||
Collection<MessageId> getMessagesToShare(Transaction txn,
|
||||
ClientId c) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the message with the given ID, in serialised form, or null if
|
||||
* the message has been deleted.
|
||||
@@ -456,10 +465,9 @@ public interface DatabaseComponent {
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Marks the given message as shared or unshared.
|
||||
* Marks the given message as shared.
|
||||
*/
|
||||
void setMessageShared(Transaction txn, MessageId m, boolean shared)
|
||||
throws DbException;
|
||||
void setMessageShared(Transaction txn, MessageId m) throws DbException;
|
||||
|
||||
/**
|
||||
* Sets the validation and delivery state of the given message.
|
||||
|
||||
@@ -55,8 +55,9 @@ public interface ValidationManager {
|
||||
|
||||
/**
|
||||
* Called once for each incoming message that passes validation.
|
||||
* @return whether or not this message should be shared
|
||||
*/
|
||||
void incomingMessage(Transaction txn, Message m, Metadata meta)
|
||||
boolean incomingMessage(Transaction txn, Message m, Metadata meta)
|
||||
throws DbException;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user