final Exception isCorrect = connection.getState().isCorrect(protocolDataUnit);
if (isCorrect == null) {
LOGGER.trace("Adding PDU to Receiving Queue.");
final TargetMessageParser parser = (TargetMessageParser) protocolDataUnit.getBasicHeaderSegment().getParser();
final Session session = connection.getSession();
// the PDU maxCmdSN is greater than the local maxCmdSN, so we
// have to update the local one
if (session.getMaximumCommandSequenceNumber().compareTo(parser.getMaximumCommandSequenceNumber()) < 0) {
session.setMaximumCommandSequenceNumber(parser.getMaximumCommandSequenceNumber());
}
// the PDU expCmdSN is greater than the local expCmdSN, so we
// have to update the local one
if (parser.incrementSequenceNumber()) {
if (connection.getExpectedStatusSequenceNumber().compareTo(parser.getStatusSequenceNumber()) >= 0) {
connection.incrementExpectedStatusSequenceNumber();
} else {
LOGGER.error("Status Sequence Number Mismatch (received, expected): " + parser.getStatusSequenceNumber() + ", " + (connection.getExpectedStatusSequenceNumber().getValue() - 1));
}
}
} else {