mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 05:09:53 +01:00
Add log statements to MessageQueueManagerImpl in order to find bug #272
This commit is contained in:
@@ -21,6 +21,7 @@ import org.briarproject.api.sync.ValidationManager.IncomingMessageHook;
|
|||||||
import org.briarproject.util.ByteUtils;
|
import org.briarproject.util.ByteUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
@@ -63,9 +64,20 @@ class MessageQueueManagerImpl implements MessageQueueManager {
|
|||||||
QueueState queueState = loadQueueState(txn, queue.getId());
|
QueueState queueState = loadQueueState(txn, queue.getId());
|
||||||
long queuePosition = queueState.outgoingPosition;
|
long queuePosition = queueState.outgoingPosition;
|
||||||
queueState.outgoingPosition++;
|
queueState.outgoingPosition++;
|
||||||
|
if (LOG.isLoggable(INFO)) {
|
||||||
|
LOG.info("Sending message with position " +
|
||||||
|
queuePosition + " in group " +
|
||||||
|
queue.getId().hashCode() + " with transaction " +
|
||||||
|
txn.hashCode());
|
||||||
|
}
|
||||||
saveQueueState(txn, queue.getId(), queueState);
|
saveQueueState(txn, queue.getId(), queueState);
|
||||||
QueueMessage q = queueMessageFactory.createMessage(queue.getId(),
|
QueueMessage q = queueMessageFactory.createMessage(queue.getId(),
|
||||||
timestamp, queuePosition, body);
|
timestamp, queuePosition, body);
|
||||||
|
if (LOG.isLoggable(INFO)) {
|
||||||
|
LOG.info("First bytes of message: " + Arrays.toString(
|
||||||
|
Arrays.copyOfRange(q.getRaw(), 0,
|
||||||
|
QUEUE_MESSAGE_HEADER_LENGTH)));
|
||||||
|
}
|
||||||
db.addLocalMessage(txn, q, queue.getClientId(), meta, true);
|
db.addLocalMessage(txn, q, queue.getClientId(), meta, true);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
@@ -196,7 +208,12 @@ class MessageQueueManagerImpl implements MessageQueueManager {
|
|||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO)) {
|
||||||
LOG.info("Received message with position "
|
LOG.info("Received message with position "
|
||||||
+ queuePosition + ", expecting "
|
+ queuePosition + ", expecting "
|
||||||
+ queueState.incomingPosition);
|
+ queueState.incomingPosition + ". Received in group " +
|
||||||
|
m.getGroupId().hashCode() + " with transaction " +
|
||||||
|
txn.hashCode());
|
||||||
|
LOG.info("First bytes of message: " + Arrays.toString(
|
||||||
|
Arrays.copyOfRange(m.getRaw(), 0,
|
||||||
|
QUEUE_MESSAGE_HEADER_LENGTH)));
|
||||||
}
|
}
|
||||||
if (queuePosition < queueState.incomingPosition) {
|
if (queuePosition < queueState.incomingPosition) {
|
||||||
// A message with this queue position has already been seen
|
// A message with this queue position has already been seen
|
||||||
|
|||||||
Reference in New Issue
Block a user