-
Notifications
You must be signed in to change notification settings - Fork 618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wait for Logout response or timeout before disconnect on session reset #312
Conversation
Thanks for the PR. I did not check the code yet but have one question: in |
@chrjohn Looking at how |
@chrjohn I have now pushed an improved version. I squashed the new commit with the previous one so that you only have to review one. I have also edited the description of the pr. to reflect the new changes. Please review thoroughly when you can find the time. |
Wait for Logout response or timeout before disconnect on session reset.
This looks okay to me - it doesn't fix #300 but we can probably build that on top... |
@simenflatby thanks for this and 👍 for the extensive test coverage. Currently not sure if I want to put this to the next patch release (to be released during the next weeks I think) since the state flags (i.e. the already existing ones) are hard to follow already and there were some problems around them during the last years. So will take an extra look later... |
@chrjohn My pleasure. I'm no longer with the company that I did the FIX integration that required this for, so I will not be able to test it in a real life project. If there is any questions, feel free to let me know and I will try to answer. @philipwhiuk There has been some months since i looked at this code, so bear with me if I'm wrong: Would not calling |
@simenflatby One question though: is there a specific reason why you used an |
@chrjohn I can not remember, but from looking at it now, it looks like a sloppy copy-paste of the other state flags. It should probably be changed. I'm not in front of a dev computer for a while. Will you change it please? Otherwise I can do it after the weekend. Cheers! |
Please leave it for the time being. Need to think about if it needs to go into the SessionState class...
|
@simenflatby , I think this state flag needs to be moved to the |
@chrjohn Unfortunately I have a lot on my schedule in January and February and I do not think I can find any time for OpenSource work. If it can wait until after that, I can definitely give it a shot. Just let me know! |
@simenflatby , no worries, I'll plan to do it then. Thanks for your work on this. 👍 |
Fixes #244
This is my first attempt to contribute to the core QuickFIX/J codebase. Please read the described changes bellow and review the changes thoroughly.
Relevant changes
quickfix.Session#reset()
quickfix.Session#generateLogout()
followed byquickfix.Session#disconnect(String, boolean)
, setquickfix.Session#isResetStatePending
flag and callquickfix.Session#logout(String)
followed byquickfix.Session#generateLogout(String)
.quickfix.Session#logout(String)
will setquickfix.Session#enabled
tofalse
andquickfix.Session#generateLogout(String)
will send aLogout
message. The flagquickfix.Session#isResetStatePending
is checked whenLogout
response is received or when timing out waiting for aLogout
response.quickfix.Session#resetState()
if there is no need to logout.quickfix.Session#nextLogout(Message)
quickfix.Session#isResetStatePending
flag is set.quickfix.Session#next()
quickfix.Session#reset()
when outside of session time andquickfix.Session#isResetStatePending
flag is set.quickfix.Session#disconnect(String, boolean)
.Logout
timeout beforeHeartBeat
timeout.quickfix.Session#disconnect(String, boolean)
quickfix.Session#isResetStatePending
flag is set.quickfix.Session#resetState()
quickfix.Session#isResetStatePending
flag.quickfix.SessionTest#testLogonLogoutOnAcceptor()
quickfix.SessionTest#logoutFrom(Session, int)
. This is needed because we need to receive a Logout response in order to trigger the session reset.quickfix.SessionTest#testStartOfInitiatorOutsideOfSessionTime()
quickfix.SessionTest#logoutFrom(Session, int)
. This is needed because we need to receive a Logout response in order to trigger the session reset. If we would like to simulate aLogout
timeout instead since we are outside of session time, we could replace the call toquickfix.SessionTest#logoutFrom(Session, int)
withsystemTimeSource.increment(TimeUnit.HOURS.toMillis(state.getLogoutTimeout()) * 2); session.next();
.