Source:
public Exchange receiveResponse(Response response) { KeyMID idByMID; if (response.getType() == Type.ACK) { idByMID = new KeyMID(response.getMID(), null, 0); } else { idByMID = new KeyMID(response.getMID(), response.getSource().getAddress(), response.getSourcePort()); } KeyToken idByToken = new KeyToken(response.getToken()); Exchange exchange = exchangesByToken.get(idByToken); if (exchange != null) { if (response.getType() == Type.ACK && exchange.getCurrentRequest().getMID() != response.getMID()) { LOGGER.warning("Possible MID reuse before lifetime end: "+response.getTokenString()+" expected MID "+exchange.getCurrentRequest().getMID()+" but received "+response.getMID()); return null; } if (exchange.getCurrentRequest().isMulticast()) { LOGGER.log(Level.FINER, "Received response for multicast request: {0}", response); } else { if ((response.getType() == Type.CON || response.getType() == Type.NON) && deduplicator.findPrevious(idByMID, exchange) != null) { LOGGER.info("Duplicate response for open exchange: "+response); response.setDuplicate(true); } else { idByMID = new KeyMID(exchange.getCurrentRequest().getMID(), null, 0); exchangesByMID.remove(idByMID, exchange); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Closed open request with "+idByMID); } } return exchange; } else { if (response.getType() != Type.ACK) { Exchange prev = deduplicator.find(idByMID); if (prev != null) { LOGGER.info("Duplicate response for completed exchange: "+response); response.setDuplicate(true); return prev; } } else { LOGGER.info("Ignoring unmatchable piggy-backed response from "+response.getSource()+":"+response.getSourcePort()+": "+response); } return null; } }

Target:
public Exchange receiveResponse(Response response) { KeyMID idByMID; if (response.getType() == Type.ACK) { idByMID = new KeyMID(response.getMID(), null, 0); } else { idByMID = new KeyMID(response.getMID(), response.getSource().getAddress(), response.getSourcePort()); } KeyToken idByToken = new KeyToken(response.getToken()); Exchange exchange = exchangesByToken.get(idByToken); if (exchange != null) { if (response.getType() == Type.ACK && exchange.getCurrentRequest().getMID() != response.getMID()) { LOGGER.warning("Possible MID reuse before lifetime end: "+response.getTokenString()+" expected MID "+exchange.getCurrentRequest().getMID()+" but received "+response.getMID()); return null; } if ((response.getType() == Type.CON || response.getType() == Type.NON) && deduplicator.findPrevious(idByMID, exchange) != null) { LOGGER.info("Duplicate response for open exchange: "+response); response.setDuplicate(true); } else { idByMID = new KeyMID(exchange.getCurrentRequest().getMID(), null, 0); exchangesByMID.remove(idByMID, exchange); if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Closed open request with "+idByMID); } return exchange; } else { if (response.getType() != Type.ACK) { Exchange prev = deduplicator.find(idByMID); if (prev != null) { LOGGER.info("Duplicate response for completed exchange: "+response); response.setDuplicate(true); return prev; } } else { LOGGER.info("Ignoring unmatchable piggy-backed response from "+response.getSource()+":"+response.getSourcePort()+": "+response); } return null; } }