Skip to content

Commit

Permalink
Merge pull request connamara#324 from martinadams/issue_#273
Browse files Browse the repository at this point in the history
  • Loading branch information
mgatny committed Jul 8, 2015
2 parents c84648d + a7c1d27 commit 4919476
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NEXT_VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ Changes since the last version (oldest first):
* (patch) #80 - fixes to tag-141-related sequence resets (TomasVetrovsky,akamyshanov,gbirchmeier)
* (patch) #315 - make config file section headers be case-insensitive, for parity with QF/j (gbirchmeier)
* (minor) #314 - New feature: add/remove sessions dynamically (martinadams)

* (patch) #273 - prevent non-logon message traffic unless fully logged on (martinadams)
2 changes: 2 additions & 0 deletions QuickFIXn/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ public void Next(Message message)

if (MsgType.LOGON.Equals(msgType))
NextLogon(message);
else if (!IsLoggedOn)
Disconnect(string.Format("Received msg type '{0}' when not logged on", msgType));
else if (MsgType.HEARTBEAT.Equals(msgType))
NextHeartbeat(message);
else if (MsgType.TEST_REQUEST.Equals(msgType))
Expand Down
16 changes: 16 additions & 0 deletions UnitTests/SessionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,5 +791,21 @@ public void TestApplicationExtension()
Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.LOGON));
Assert.True(mockApp.InterceptedMessageTypes.Contains(QuickFix.Fields.MsgType.NEWORDERSINGLE));
}

[Test]
public void TestRequireLogon()
{
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));
// This should cause disconnect, because first message is something other than a logon.
SendTheMessage(order);
Assert.That(DISCONNECTED());
}

}
}

0 comments on commit 4919476

Please sign in to comment.