Skip to content

Commit

Permalink
Merge pull request connamara#939 from gbirchmeier/session-refactors
Browse files Browse the repository at this point in the history
minor checkTooHigh/TooLow refactor in Session.cs
  • Loading branch information
gbirchmeier authored Feb 20, 2025
2 parents 49990fd + fd4d925 commit bc2c1d7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
47 changes: 24 additions & 23 deletions QuickFIXn/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ protected void NextSequenceReset(Message sequenceReset)

public bool Verify(Message msg, bool checkTooHigh = true, bool checkTooLow = true)
{
SeqNumType msgSeqNum = 0;
string msgType;

try
Expand All @@ -914,33 +913,35 @@ public bool Verify(Message msg, bool checkTooHigh = true, bool checkTooLow = tru
}

if (checkTooHigh || checkTooLow)
msgSeqNum = msg.Header.GetULong(Fields.Tags.MsgSeqNum);

if (checkTooHigh && IsTargetTooHigh(msgSeqNum))
{
DoTargetTooHigh(msg, msgSeqNum);
return false;
}
if (checkTooLow && IsTargetTooLow(msgSeqNum))
{
DoTargetTooLow(msg, msgSeqNum);
return false;
}
SeqNumType msgSeqNum = msg.Header.GetULong(Fields.Tags.MsgSeqNum);

if ((checkTooHigh || checkTooLow) && _state.ResendRequested())
{
ResendRange range = _state.GetResendRange();
if (msgSeqNum >= range.EndSeqNo)
if (checkTooHigh && IsTargetTooHigh(msgSeqNum))
{
Log.OnEvent("ResendRequest for messages FROM: " + range.BeginSeqNo + " TO: " + range.EndSeqNo + " has been satisfied.");
_state.SetResendRange(0, 0);
DoTargetTooHigh(msg, msgSeqNum);
return false;
}
else if (msgSeqNum >= range.ChunkEndSeqNo)
if (checkTooLow && IsTargetTooLow(msgSeqNum))
{
Log.OnEvent("Chunked ResendRequest for messages FROM: " + range.BeginSeqNo + " TO: " + range.ChunkEndSeqNo + " has been satisfied.");
SeqNumType newChunkEndSeqNo = Math.Min(range.EndSeqNo, range.ChunkEndSeqNo + MaxMessagesInResendRequest);
GenerateResendRequestRange(msg.Header.GetString(Fields.Tags.BeginString), range.ChunkEndSeqNo + 1, newChunkEndSeqNo);
range.ChunkEndSeqNo = newChunkEndSeqNo;
DoTargetTooLow(msg, msgSeqNum);
return false;
}

if (_state.ResendRequested())
{
ResendRange range = _state.GetResendRange();
if (msgSeqNum >= range.EndSeqNo)
{
Log.OnEvent("ResendRequest for messages FROM: " + range.BeginSeqNo + " TO: " + range.EndSeqNo + " has been satisfied.");
_state.SetResendRange(0, 0);
}
else if (msgSeqNum >= range.ChunkEndSeqNo)
{
Log.OnEvent("Chunked ResendRequest for messages FROM: " + range.BeginSeqNo + " TO: " + range.ChunkEndSeqNo + " has been satisfied.");
SeqNumType newChunkEndSeqNo = Math.Min(range.EndSeqNo, range.ChunkEndSeqNo + MaxMessagesInResendRequest);
GenerateResendRequestRange(msg.Header.GetString(Fields.Tags.BeginString), range.ChunkEndSeqNo + 1, newChunkEndSeqNo);
range.ChunkEndSeqNo = newChunkEndSeqNo;
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ What's New
* **There are breaking changes between 1.10 and 1.11! Please review the 1.11.0 notes below.**

### next release
* #nnn - placeholder

**Non-breaking changes**
* #939 - minor checkTooHigh/checkTooLow refactor in Session.cs (gbirchmeier)

### v1.13.0

Expand Down

0 comments on commit bc2c1d7

Please sign in to comment.