Skip to content

Commit

Permalink
fix bug with reattempt condition in new fix sender end point
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardWarburton committed May 12, 2022
1 parent 873ae19 commit be68144
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public void onMessage(
{
final int metaDataOffset = offset - FixMessageDecoder.bodyHeaderLength() - metaDataLength;

if ((replaying && !replay) || (!replaying && replay) || reattemptBytesWritten > 0)
if ((replaying && !replay) || (!replaying && replay) || requiresRetry)
{
enqueueMessage(directBuffer, offset, bodyLength, metaDataOffset, metaDataLength, seqNum, replay);
return;
Expand Down Expand Up @@ -298,7 +298,6 @@ private int writeBuffer(
ByteBufferUtil.position(buffer, reattemptBytesWritten + offset);

final int written = channel.write(buffer);
// System.out.println("written = " + written);
ByteBufferUtil.position(buffer, offset);
DebugLogger.logBytes(FIX_MESSAGE_TCP, "Written ", buffer, startPosition, written);

Expand All @@ -317,10 +316,6 @@ private void enqueueMessage(
int reattemptOffset = reattemptState.usage - totalLength;
final ExpandableDirectByteBuffer buffer = reattemptState.buffer();

/*System.out.println("FixSenderEndPoint.enqueueMessage" + ", sequenceNumber = " + sequenceNumber +
", metaDataLength = " + metaDataLength +
", reattemptOffset = " + reattemptOffset);*/

buffer.putInt(reattemptOffset, ENQ_MSG);
reattemptOffset += SIZE_OF_INT;

Expand Down Expand Up @@ -398,8 +393,6 @@ private boolean processReattemptBuffer(final boolean replay)
final ReattemptState reattemptState = reattemptState(replay);
final ExpandableDirectByteBuffer buffer = reattemptState.buffer;
final int reattemptBufferUsage = reattemptState.usage;
// System.out.println("FixSenderEndPoint.processReattemptBuffer, reattemptBufferUsage = " +
// reattemptBufferUsage);
if (reattemptBufferUsage == 0)
{
return true;
Expand All @@ -411,14 +404,10 @@ private boolean processReattemptBuffer(final boolean replay)
try
{
final int enqueueType = buffer.getInt(offset);
// System.out.println("enqueueType = " + enqueueType + ", offset = " + offset + ", replay = " + replay);
// System.out.println("reattemptState.buffer = " + reattemptState.buffer);
// System.out.println();
if (enqueueType == ENQ_MSG)
{
final int sequenceNumberOffset = offset + SIZE_OF_INT;
final int sequenceNumber = buffer.getInt(sequenceNumberOffset);
// System.out.println("sequenceNumber = " + sequenceNumber);

final int bodyLengthOffset = sequenceNumberOffset + SIZE_OF_INT;
final int bodyLength = buffer.getInt(bodyLengthOffset);
Expand Down Expand Up @@ -733,13 +722,9 @@ ExpandableDirectByteBuffer buffer()
if (buffer == null)
{
buffer = this.buffer = new ExpandableDirectByteBuffer();
// System.out.println("buffer = " + buffer);
}

// System.out.println("usage = " + usage);
// System.out.println("before checkLimit buffer = " + buffer);
buffer.checkLimit(usage);
// System.out.println("after checkLimit buffer = " + buffer);

return buffer;
}
Expand Down

0 comments on commit be68144

Please sign in to comment.