private void nextResendRequest(Message resendRequest) throws IOException, RejectLogon, FieldNotFound, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType, InvalidMessage { // QFJ-653: Check if seqnums are too low. // QFJ-673: Do not check if seqnums are too high in verify() since in case of a seqnum mismatch this will // enqueue the ResendRequest for later processing. This might lead to a deadlock situation in // which the counterparty waits for our messages to be resent and we are also waiting for our // ResendRequest to be satisfied in order to process the queued ResendRequest of the counterparty. // Instead, send out the requested messages and afterwards enqueue the ResendRequest in order to // later increase the target seqnum in method nextQueued(int). if (!verify(resendRequest, false, validateSequenceNumbers)) { return; } final int msgSeqNum = resendRequest.getHeader().getInt(MsgSeqNum.FIELD); if (validateSequenceNumbers && isTargetTooHigh(msgSeqNum)) { enqueueMessage(resendRequest, msgSeqNum); } final int beginSeqNo = resendRequest.getInt(BeginSeqNo.FIELD); final int endSeqNo = resendRequest.getInt(EndSeqNo.FIELD); getLog().onEvent( "Received ResendRequest FROM: " + beginSeqNo + " TO: " + formatEndSeqNum(endSeqNo)); manageGapFill(resendRequest, beginSeqNo, endSeqNo); }
private void nextResendRequest(Message resendRequest) throws IOException, RejectLogon, FieldNotFound, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType, InvalidMessage { // QFJ-653: Check if seqnums are too low. // QFJ-673: Do not check if seqnums are too high in verify() since in case of a seqnum mismatch this will // enqueue the ResendRequest for later processing. This might lead to a deadlock situation in // which the counterparty waits for our messages to be resent and we are also waiting for our // ResendRequest to be satisfied in order to process the queued ResendRequest of the counterparty. // Instead, send out the requested messages and afterwards enqueue the ResendRequest in order to // later increase the target seqnum in method nextQueued(int). if (!verify(resendRequest, false, validateSequenceNumbers)) { return; } final int msgSeqNum = resendRequest.getHeader().getInt(MsgSeqNum.FIELD); if (validateSequenceNumbers && isTargetTooHigh(msgSeqNum)) { enqueueMessage(resendRequest, msgSeqNum); } final int beginSeqNo = resendRequest.getInt(BeginSeqNo.FIELD); final int endSeqNo = resendRequest.getInt(EndSeqNo.FIELD); getLog().onEvent( "Received ResendRequest FROM: " + beginSeqNo + " TO: " + formatEndSeqNum(endSeqNo)); manageGapFill(resendRequest, beginSeqNo, endSeqNo); }
private void nextResendRequest(Message resendRequest) throws IOException, RejectLogon, FieldNotFound, IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType, InvalidMessage { // QFJ-653: Check if seqnums are too low. // QFJ-673: Do not check if seqnums are too high in verify() since in case of a seqnum mismatch this will // enqueue the ResendRequest for later processing. This might lead to a deadlock situation in // which the counterparty waits for our messages to be resent and we are also waiting for our // ResendRequest to be satisfied in order to process the queued ResendRequest of the counterparty. // Instead, send out the requested messages and afterwards enqueue the ResendRequest in order to // later increase the target seqnum in method nextQueued(int). if (!verify(resendRequest, false, validateSequenceNumbers)) { return; } final int msgSeqNum = resendRequest.getHeader().getInt(MsgSeqNum.FIELD); if (validateSequenceNumbers && isTargetTooHigh(msgSeqNum)) { enqueueMessage(resendRequest, msgSeqNum); } final int beginSeqNo = resendRequest.getInt(BeginSeqNo.FIELD); final int endSeqNo = resendRequest.getInt(EndSeqNo.FIELD); getLog().onEvent( "Received ResendRequest FROM: " + beginSeqNo + " TO: " + formatEndSeqNum(endSeqNo)); manageGapFill(resendRequest, beginSeqNo, endSeqNo); }
private void doTargetTooHigh(Message msg) throws FieldNotFound, IOException, InvalidMessage { final Message.Header header = msg.getHeader(); final String beginString = header.getString(BeginString.FIELD); final int msgSeqNum = header.getInt(MsgSeqNum.FIELD); getLog().onEvent( "MsgSeqNum too high, expecting " + getExpectedTargetNum() + " but received " + msgSeqNum + ": " + msg); enqueueMessage(msg, msgSeqNum); if (state.isResendRequested()) { final ResendRange range = state.getResendRange(); if (!redundantResentRequestsAllowed && msgSeqNum >= range.getBeginSeqNo()) { getLog().onEvent( "Already sent ResendRequest FROM: " + range.getBeginSeqNo() + " TO: " + range.getEndSeqNo() + ". Not sending another."); return; } } generateResendRequest(beginString, msgSeqNum); }
private void doTargetTooHigh(Message msg) throws FieldNotFound, IOException, InvalidMessage { final Message.Header header = msg.getHeader(); final String beginString = header.getString(BeginString.FIELD); final int msgSeqNum = header.getInt(MsgSeqNum.FIELD); getLog().onEvent( "MsgSeqNum too high, expecting " + getExpectedTargetNum() + " but received " + msgSeqNum + ": " + msg); enqueueMessage(msg, msgSeqNum); if (state.isResendRequested()) { final ResendRange range = state.getResendRange(); if (!redundantResentRequestsAllowed && msgSeqNum >= range.getBeginSeqNo()) { getLog().onEvent( "Already sent ResendRequest FROM: " + range.getBeginSeqNo() + " TO: " + range.getEndSeqNo() + ". Not sending another."); return; } } generateResendRequest(beginString, msgSeqNum); }
private void doTargetTooHigh(Message msg) throws FieldNotFound, IOException, InvalidMessage { final Message.Header header = msg.getHeader(); final String beginString = header.getString(BeginString.FIELD); final int msgSeqNum = header.getInt(MsgSeqNum.FIELD); getLog().onEvent( "MsgSeqNum too high, expecting " + getExpectedTargetNum() + " but received " + msgSeqNum + ": " + msg); enqueueMessage(msg, msgSeqNum); if (state.isResendRequested()) { final ResendRange range = state.getResendRange(); if (!redundantResentRequestsAllowed && msgSeqNum >= range.getBeginSeqNo()) { getLog().onEvent( "Already sent ResendRequest FROM: " + range.getBeginSeqNo() + " TO: " + range.getEndSeqNo() + ". Not sending another."); return; } } generateResendRequest(beginString, msgSeqNum); }