Source:
public void receiveRequest(final Exchange exchange, final Request request) { if (request.isDuplicate()) { if (exchange.getSendTimestamp() > request.getTimestamp()) { int c = counter.incrementAndGet(); LOGGER.warn("{}: duplicate request {}, server sent response delayed, ignore request", c, exchange, request); return; } exchange.retransmitResponse(); Response currentResponse = exchange.getCurrentResponse(); if (currentResponse != null) { if (currentResponse.getType() == Type.NON || currentResponse.getType() == Type.CON) { if (request.isConfirmable()) { EmptyMessage ack = EmptyMessage.newACK(request); sendEmptyMessage(exchange, ack); } if (currentResponse.isConfirmable()) { int failedCount = exchange.getFailedTransmissionCount() + 1; exchange.setFailedTransmissionCount(failedCount); LOGGER.debug("{} request duplicate: retransmit response, failed: {}, response: {}", exchange, failedCount, currentResponse); currentResponse.retransmitting(); sendResponse(exchange, currentResponse); return; } } LOGGER.debug("{} respond with the current response to the duplicate request", exchange); lower().sendResponse(exchange, currentResponse); } else if (exchange.getCurrentRequest().isAcknowledged()) { LOGGER.debug("{} duplicate request was acknowledged but no response computed yet. Retransmit ACK", exchange); EmptyMessage ack = EmptyMessage.newACK(request); sendEmptyMessage(exchange, ack); } else if (exchange.getCurrentRequest().isRejected()) { LOGGER.debug("{} duplicate request was rejected. Reject again", exchange); EmptyMessage rst = EmptyMessage.newRST(request); sendEmptyMessage(exchange, rst); } else { LOGGER.debug("{} server has not yet decided what to do with the request. We ignore the duplicate.", exchange); } } else { exchange.setCurrentRequest(request); upper().receiveRequest(exchange, request); } }

Target:
public void receiveRequest(final Exchange exchange, final Request request) { if (request.isDuplicate()) { if (exchange.getSendNanoTimestamp() > request.getReceiveNanoTimestamp()) { int c = counter.incrementAndGet(); LOGGER.warn("{}: duplicate request {}, server sent response delayed, ignore request", c, exchange, request); return; } exchange.retransmitResponse(); Response currentResponse = exchange.getCurrentResponse(); if (currentResponse != null) { if (currentResponse.getType() == Type.NON || currentResponse.getType() == Type.CON) { if (request.isConfirmable()) { EmptyMessage ack = EmptyMessage.newACK(request); sendEmptyMessage(exchange, ack); } if (currentResponse.isConfirmable()) { int failedCount = exchange.getFailedTransmissionCount() + 1; exchange.setFailedTransmissionCount(failedCount); LOGGER.debug("{} request duplicate: retransmit response, failed: {}, response: {}", exchange, failedCount, currentResponse); currentResponse.retransmitting(); sendResponse(exchange, currentResponse); return; } } LOGGER.debug("{} respond with the current response to the duplicate request", exchange); lower().sendResponse(exchange, currentResponse); } else if (exchange.getCurrentRequest().isAcknowledged()) { LOGGER.debug("{} duplicate request was acknowledged but no response computed yet. Retransmit ACK", exchange); EmptyMessage ack = EmptyMessage.newACK(request); sendEmptyMessage(exchange, ack); } else if (exchange.getCurrentRequest().isRejected()) { LOGGER.debug("{} duplicate request was rejected. Reject again", exchange); EmptyMessage rst = EmptyMessage.newRST(request); sendEmptyMessage(exchange, rst); } else { LOGGER.debug("{} server has not yet decided what to do with the request. We ignore the duplicate.", exchange); } } else { exchange.setCurrentRequest(request); upper().receiveRequest(exchange, request); } }