mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Pass original message to BDF validators and hooks.
This commit is contained in:
@@ -29,8 +29,9 @@ public abstract class BdfIncomingMessageHook implements IncomingMessageHook,
|
||||
this.metadataParser = metadataParser;
|
||||
}
|
||||
|
||||
protected abstract void incomingMessage(Transaction txn, BdfList message,
|
||||
BdfDictionary meta) throws DbException, FormatException;
|
||||
protected abstract void incomingMessage(Transaction txn, Message m,
|
||||
BdfList body, BdfDictionary meta) throws DbException,
|
||||
FormatException;
|
||||
|
||||
@Override
|
||||
public void incomingMessage(Transaction txn, Message m, Metadata meta)
|
||||
@@ -48,10 +49,10 @@ public abstract class BdfIncomingMessageHook implements IncomingMessageHook,
|
||||
int headerLength) throws DbException {
|
||||
try {
|
||||
byte[] raw = m.getRaw();
|
||||
BdfList message = clientHelper.toList(raw, headerLength,
|
||||
BdfList body = clientHelper.toList(raw, headerLength,
|
||||
raw.length - headerLength);
|
||||
BdfDictionary metaDictionary = metadataParser.parse(meta);
|
||||
incomingMessage(txn, message, metaDictionary);
|
||||
incomingMessage(txn, m, body, metaDictionary);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public abstract class BdfMessageValidator implements MessageValidator,
|
||||
this.clock = clock;
|
||||
}
|
||||
|
||||
protected abstract BdfDictionary validateMessage(BdfList message, Group g,
|
||||
long timestamp) throws FormatException;
|
||||
protected abstract BdfDictionary validateMessage(Message m, Group g,
|
||||
BdfList body) throws FormatException;
|
||||
|
||||
@Override
|
||||
public Metadata validateMessage(Message m, Group g) {
|
||||
@@ -63,9 +63,9 @@ public abstract class BdfMessageValidator implements MessageValidator,
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
BdfList message = clientHelper.toList(raw, headerLength,
|
||||
BdfList body = clientHelper.toList(raw, headerLength,
|
||||
raw.length - headerLength);
|
||||
BdfDictionary meta = validateMessage(message, g, m.getTimestamp());
|
||||
BdfDictionary meta = validateMessage(m, g, body);
|
||||
if (meta == null) {
|
||||
LOG.info("Invalid message");
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user