I have a custom AcceptorSessionProvider similar to DynamicAcceptorSessionProvider.
The Sessions that get created on-the-fly at Logon time sometimes get disconnected right away. If the SessionID has never been seen before, it works fine. The disconnect only happens if the MessageStore has a previous *.session file lying around from a previous day. Subsequent logons by the same client work fine.
The problem was that Session.checkSessionTime always returns false in the constructor, and it caches this result for 1 second. The fix is to NOT cache a negative result. Apologies for my bad habit of posting patches here in the description, but it seems silly to attach a file when the fix is just a single line change:
Index: core/src/main/java/quickfix/Session.java
===================================================================
— core/src/main/java/quickfix/Session.java (revision 950)
+++ core/src/main/java/quickfix/Session.java (working copy)
@@ -489,7 +489,7 @@
// necessary to do for every message received.
//
Date date = SystemTime.getDate();
- if ((date.getTime() - lastSessionTimeCheck) >= 1000L) {
+ if (!lastSessionTimeResult || (date.getTime() - lastSessionTimeCheck) >= 1000L) {
Date getSessionCreationTime = state.getCreationTime();
lastSessionTimeResult = sessionSchedule.isSameSession(SystemTime.getUtcCalendar(date),
SystemTime.getUtcCalendar(getSessionCreationTime));
|