Skip to content

Commit

Permalink
Merge pull request #316 from gbirchmeier/80reset
Browse files Browse the repository at this point in the history
(#80) AT: logon with reset after disconnect
  • Loading branch information
gbirchmeier committed Jun 8, 2015
2 parents 65eeeaf + fdfe748 commit b632b69
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 7 deletions.
1 change: 0 additions & 1 deletion AcceptanceTest/cfg/.gitignore

This file was deleted.

15 changes: 15 additions & 0 deletions AcceptanceTest/cfg/at_44_noreset.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[DEFAULT]
Verbose=Y
FileLogPath=log
ConnectionType=acceptor
SocketAcceptPort=5005
SocketReuseAddress=Y
StartTime=00:00:00
EndTime=00:00:00
SenderCompID=ISLD
TargetCompID=TW
ResetOnLogon=N
FileStorePath=store
[SESSION]
BeginString=FIX.4.4
DataDictionary=..\spec\fix\FIX44.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Issue #80: logon with reset _after_disconnect_

iCONNECT
# logon with reset, because this config has ResetOnLogon=N
I8=FIX.4.435=A34=149=TW52=<TIME>56=ISLD98=0108=30141=Y
E8=FIX.4.49=6735=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=30141=Y10=0
I8=FIX.4.435=034=249=TW52=<TIME>56=ISLD
I8=FIX.4.435=034=349=TW52=<TIME>56=ISLD
I8=FIX.4.435=034=449=TW52=<TIME>56=ISLD
I8=FIX.4.435=034=549=TW52=<TIME>56=ISLD
I8=FIX.4.435=034=649=TW52=<TIME>56=ISLD
I8=FIX.4.435=034=749=TW52=<TIME>56=ISLD
I8=FIX.4.435=034=849=TW52=<TIME>56=ISLD
I8=FIX.4.435=034=949=TW52=<TIME>56=ISLD

#Send TestRequest, expect HeartBeat response
I8=FIX.4.435=134=1049=TW52=<TIME>56=ISLD112=1
E8=FIX.4.49=5535=034=249=ISLD52=<TIME>56=TW112=1

#Logout and response
I8=FIX.4.435=534=1149=TW52=<TIME>56=ISLD
E8=FIX.4.49=4935=534=349=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
iCONNECT

#send a Logon with ResetSeqNumFlag set to Y and with MsgSeqNum of 1
I8=FIX.4.435=A34=149=TW52=<TIME>56=ISLD98=0108=30141=Y
#Expect a response with a Logon with ResetSeqNumFlag set to Y and with MsgSeqNum of 1.
E8=FIX.4.49=6735=A34=149=ISLD52=00000000-00:00:00.00056=TW98=0108=30141=Y10=0

#Send TestRequest (MsgSeqNum = 2) expect to receive HeartBeat (MsgSeqNum = 2)
I8=FIX.4.435=134=249=TW52=<TIME>56=ISLD112=1
E8=FIX.4.49=5535=034=249=ISLD52=<TIME>56=TW112=1

# logout message and response
I8=FIX.4.435=534=349=TW52=<TIME>56=ISLD
E8=FIX.4.49=4935=534=349=ISLD52=00000000-00:00:00.00056=TW10=0

eDISCONNECT
8 changes: 4 additions & 4 deletions QuickFIXn/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public bool Send(string message)

// TODO for v2 - rename, make internal
/// <summary>
/// Sets some internal state variables. Despite the name, it does do anything to make a logon occur.
/// Sets some internal state variables. Despite the name, it does not do anything to make a logon occur.
/// </summary>
public void Logon()
{
Expand Down Expand Up @@ -667,10 +667,10 @@ protected void NextLogon(Message logon)

if (state_.ReceivedReset)
{
this.Log.OnEvent("Logon contains ResetSeqNumFlag=Y, reseting sequence numbers to 1");
this.Log.OnEvent("Sequence numbers reset due to ResetSeqNumFlag=Y");
if (!state_.SentReset)
{
state_.Reset("Reseting because reset was requested by counterparty.");
state_.Reset("Reset requested by counterparty");
}
}

Expand All @@ -684,7 +684,7 @@ protected void NextLogon(Message logon)

if (!IsGoodTime(logon))
{
this.Log.OnEvent("Logon had bad sending time");
this.Log.OnEvent("Logon has bad sending time");
Disconnect("bad sending time");
return;
}
Expand Down
14 changes: 12 additions & 2 deletions acceptance_test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set RESULT41=
set RESULT42=
set RESULT43=
set RESULT44=
set RESULT44_NORESET=
set RESULT50=
set RESULT50SP1=
set RESULT50SP2=
Expand Down Expand Up @@ -48,7 +49,14 @@ pushd AcceptanceTest
if ERRORLEVEL 1 set RESULT44=1
echo "44 tests result: %RESULT44%"
copy TestResult.xml AcceptanceTests_44.xml


call pause
del TestResult.xml
call runat release 5005 definitions/server/fix44noreset/*.def cfg/at_44_noreset.cfg
if ERRORLEVEL 1 set RESULT44_NORESET=1
echo "44 tests result: %RESULT44_NORESET%"
copy TestResult.xml AcceptanceTests_44_noreset.xml

call pause
del TestResult.xml
call runat release 5006 definitions/server/fix50/*.def cfg/at_50.cfg
Expand Down Expand Up @@ -86,12 +94,14 @@ echo " 41: %RESULT41%"
echo " 42: %RESULT42%"
echo " 43: %RESULT43%"
echo " 44: %RESULT44%"
echo " 44nr: %RESULT44_NORESET%"
echo " 50: %RESULT50%"
echo "50 SP1: %RESULT50SP1%"
echo "50 SP2: %RESULT50SP2%"
echo " MISC: %RESULTMISC%"

set /a RETURNVALUE=RESULT40+RESULT41+RESULT42+RESULT43+RESULT44+RESULT50+RESULT50SP1+RESULT50SP2+RESULTMISC
set /a RETURNVALUE=RESULT40+RESULT41+RESULT42+RESULT43+RESULT44+RESULT44_NORESET+RESULT50+RESULT50SP1+RESULT50SP2+RESULTMISC

echo "Script returns: %RETURNVALUE%"
echo "(0 means success)"
exit /B %RETURNVALUE%

0 comments on commit b632b69

Please sign in to comment.