Fix for dropped logout message issue #130
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for issue described in forum post: Acceptor dropping logout messages.
The issue exists in 1.6.x so would be good to merge there too.
Issue
When a FIX acceptor is shutdown, a call is made to
SessionConnector.logoutAllSessions()
. This callsSession.logout()
on all sessions in turn, regardless of prior status. The logout() method is asynchronous and merely sets a private flag inSession
. The actual logout message is sent later when the flag is picked up by a background thread (see Session.next()).After the
SessionConnector.logout()
call completes, theSessionConnector
should wait for all sessions to be logged out. However, due to incorrect use ofSessionConnector.isLoggedOn()
,waitForLogout()
is never called.isLoggedOn()
performs an AND-style operation on the results of allsession.isLoggedOn()
methods. This means that if one or more sessions are not logged on, we do not wait for those that are.Fix
The simple fix is to add a new method
anyLoggedOn()
to check if any of the FIX sessions are logged on. If so, thenwaitForLogout()
is called and the required logout messages are sent before termination of the connection.