Source:
<code>public final void processMessage(Record record) throws HandshakeException { <START> if (session.getReadEpoch() != record.getEpoch() || !session.isDuplicate(record.getSequenceNumber())) { <END> try { record.setSession(session); DTLSMessage messageToProcess = inboundMessageBuffer.getNextMessage(record); while (messageToProcess != null) { if (messageToProcess instanceof FragmentedHandshakeMessage) { messageToProcess = handleFragmentation((FragmentedHandshakeMessage) messageToProcess); } if (messageToProcess == null) { } else { if (messageToProcess instanceof GenericHandshakeMessage) { HandshakeParameter parameter = session.getParameter(); if (parameter == null) { throw new IllegalStateException("handshake parameter are required!"); } messageToProcess = ((GenericHandshakeMessage) messageToProcess) .getSpecificHandshakeMessage(parameter); } doProcessMessage(messageToProcess); } messageToProcess = inboundMessageBuffer.getNextMessage(); } session.markRecordAsRead(record.getEpoch(), record.getSequenceNumber()); } catch (GeneralSecurityException e) { LOGGER.warn("Cannot process handshake message from peer due to [{}]", getSession().getPeer(), e.getMessage(), e); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.INTERNAL_ERROR, session.getPeer()); throw new HandshakeException("Cannot process handshake message", alert); } } else { LOGGER.trace("Discarding duplicate HANDSHAKE message received from peer [{}]:{}{}", record.getPeerAddress(), StringUtil.lineSeparator(), record); } }</code><technical_language>this new check</technical_language>

Target:
public final void processMessage(Record record) throws HandshakeException { boolean sameEpoch = session.getReadEpoch() == record.getEpoch(); if ((sameEpoch && !session.isDuplicate(record.getSequenceNumber())) || (session.getReadEpoch() + 1) == record.getEpoch()) { try { record.setSession(session); DTLSMessage messageToProcess = inboundMessageBuffer.getNextMessage(record); while (messageToProcess != null) { if (messageToProcess instanceof FragmentedHandshakeMessage) { messageToProcess = handleFragmentation((FragmentedHandshakeMessage) messageToProcess); } if (messageToProcess == null) { } else { if (messageToProcess instanceof GenericHandshakeMessage) { HandshakeParameter parameter = session.getParameter(); if (parameter == null) { throw new IllegalStateException("handshake parameter are required!"); } messageToProcess = ((GenericHandshakeMessage) messageToProcess) .getSpecificHandshakeMessage(parameter); } doProcessMessage(messageToProcess); } messageToProcess = inboundMessageBuffer.getNextMessage(); } session.markRecordAsRead(record.getEpoch(), record.getSequenceNumber()); } catch (GeneralSecurityException e) { LOGGER.warn("Cannot process handshake message from peer due to [{}]", getSession().getPeer(), e.getMessage(), e); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.INTERNAL_ERROR, session.getPeer()); throw new HandshakeException("Cannot process handshake message", alert); } } else if (sameEpoch) { LOGGER.trace("Discarding duplicate HANDSHAKE message received from peer [{}]:{}{}", record.getPeerAddress(), StringUtil.lineSeparator(), record); } else { LOGGER.trace("Discarding HANDSHAKE message with wrong epoch received from peer [{}]:{}{}", record.getPeerAddress(), StringUtil.lineSeparator(), record); } }