Skip to content

Commit

Permalink
on resend, use toApp for send approval
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and cbusbey committed May 28, 2014
1 parent 910b365 commit 0ce7273
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
18 changes: 18 additions & 0 deletions QuickFIXn/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,11 @@ protected void NextResendRequest(Message resendReq)
{

initializeResendFields(msg);
if(!ResendApproved(msg, SessionID))
{
continue;
}

if (begin != 0)
{
GenerateSequenceReset(resendReq, begin, msgSeqNum);
Expand Down Expand Up @@ -798,6 +803,19 @@ protected void NextResendRequest(Message resendReq)
this.Log.OnEvent("ERROR during resend request " + e.Message);
}
}
private bool ResendApproved(Message msg, SessionID sessionID)
{
try
{
Application.ToApp(msg, sessionID);
}
catch (DoNotSend)
{
return false;
}

return true;
}

protected void NextLogout(Message logout)
{
Expand Down
22 changes: 22 additions & 0 deletions UnitTests/SessionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -696,5 +696,27 @@ public void TestToAppDoNotSend()
session.Send(order);
Assert.False(SENT_NOS());
}

[Test]
public void TestToAppResendDoNotSend()
{
Logon();
QuickFix.FIX42.NewOrderSingle order = new QuickFix.FIX42.NewOrderSingle(
new QuickFix.Fields.ClOrdID("1"),
new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.MANUAL_ORDER),
new QuickFix.Fields.Symbol("IBM"),
new QuickFix.Fields.Side(QuickFix.Fields.Side.BUY),
new QuickFix.Fields.TransactTime(),
new QuickFix.Fields.OrdType(QuickFix.Fields.OrdType.LIMIT));

session.Send(order);
Assert.True(SENT_NOS());

responder.msgLookup.Remove(QuickFix.Fields.MsgType.NEWORDERSINGLE);
application.doNotSendException = new QuickFix.DoNotSend();

SendResendRequest(1, 0);
Assert.False(SENT_NOS());
}
}
}

0 comments on commit 0ce7273

Please sign in to comment.