Skip to content

Commit

Permalink
Dispose StreamWriter in SetSeqNum while leaving underlying stream open
Browse files Browse the repository at this point in the history
  • Loading branch information
hlibman-connamara committed Dec 31, 2024
1 parent 8f4f5c9 commit 83094ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion QuickFIXn/Store/FileStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,11 @@ public void IncrNextTargetMsgSeqNum()
private void SetSeqNum()
{
_seqNumsFile.Seek(0, System.IO.SeekOrigin.Begin);
System.IO.StreamWriter writer = new System.IO.StreamWriter(_seqNumsFile);
System.IO.StreamWriter writer = new System.IO.StreamWriter(_seqNumsFile, leaveOpen: true);

writer.Write(NextSenderMsgSeqNum.ToString("D20") + " : " + NextTargetMsgSeqNum.ToString("D20") + " ");
writer.Flush();
writer.Dispose();
}

public DateTime? CreationTime => _cache.CreationTime;
Expand Down

0 comments on commit 83094ed

Please sign in to comment.