quickfixgo / quickfix

The Go FIX Protocol Library :rocket:
https://www.quickfixgo.org/
Other
723 stars 282 forks source link

Initiator session does not Reset Sequence Numbers on logon on Reconnect #625

Closed adam-talos closed 2 months ago

adam-talos commented 3 months ago

I'm seeing an issue where my initiator session is not resetting its sequence numbers before logon even though ResetOnLogon is set to true when the server has disconnected it.

Compare this code in QuickFIXGo: https://github.com/quickfixgo/quickfix/blob/04786a16e4a72a9eb6d30bf26376c509508da6cd/session_state.go#L46C1-L56C3

with this code in QuickFIXJ https://github.com/quickfix-j/quickfixj/blob/bb2b919b8d4f286311e05cc418dff53f9ed517e1/quickfixj-core/src/main/java/quickfix/Session.java#L2062C1-L2091C6

In QuickFIXJ, the initiator session is resetting its sequence numbers right before sending the logon message. In quickFIXGo, the store is being reset in prepMessageForSend https://github.com/quickfixgo/quickfix/blob/04786a16e4a72a9eb6d30bf26376c509508da6cd/session.go#L311C1-L328C4 Here we're checking the logon message for the 141=Y and only resetting if it is Y, so we won't try to reset the sequence numbers if we get disconnected and log on again.

I'm not sure what if there is a standard for this behavior, but probably it should match the QuickFIX standard.

adam-talos commented 3 months ago

The QuickFIX C++ also resets the sequence number each time:

https://github.com/quickfix/quickfix/blob/9c37bd7bfff6da30b556fa0aad2bbb599ba50aec/src/C%2B%2B/Session.cpp#L713C1-L714C38