--- core/src/main/java/quickfix/Session.java (original) +++ core/src/main/java/quickfix/Session.java @@ -1112,8 +1112,10 @@ } reject.setString(RefSeqNum.FIELD, msgSeqNum); +// ry 2010-09-15: Only advance the sequence number if we are at the expected number. +// What happens if msgSeqNum is invalid? if (!msgType.equals(MsgType.LOGON) && !msgType.equals(MsgType.SEQUENCE_RESET) - && !isPossibleDuplicate(message)) { + && Integer.valueOf(msgSeqNum) == getExpectedTargetNum()) { state.incrNextTargetMsgSeqNum(); } @@ -1172,8 +1174,9 @@ state.lockTargetMsgSeqNum(); try { +// ry 2010-09-15: Only advance the sequence number if we are at the expected number. if (!msgType.equals(MsgType.LOGON) && !msgType.equals(MsgType.SEQUENCE_RESET) - && (msgSeqNum == getExpectedTargetNum() || !isPossibleDuplicate(message))) { + && msgSeqNum == getExpectedTargetNum()) { state.incrNextTargetMsgSeqNum(); } } finally {