Skip to content
Snippets Groups Projects
Verified Commit 51c3528e authored by Torsten Grote's avatar Torsten Grote
Browse files

Add log statements to MessageQueueManagerImpl in order to find bug #272

parent 9fbebe22
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ import org.briarproject.api.sync.ValidationManager.IncomingMessageHook;
import org.briarproject.util.ByteUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
......@@ -63,9 +64,20 @@ class MessageQueueManagerImpl implements MessageQueueManager {
QueueState queueState = loadQueueState(txn, queue.getId());
long queuePosition = 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);
QueueMessage q = queueMessageFactory.createMessage(queue.getId(),
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);
return q;
}
......@@ -196,7 +208,12 @@ class MessageQueueManagerImpl implements MessageQueueManager {
if (LOG.isLoggable(INFO)) {
LOG.info("Received message with position "
+ 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) {
// A message with this queue position has already been seen
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment