} else if (startResend < inferredServerPath.size()) { mergeToClientQueue(startResend); } else if (startResend == inferredServerPath.size() && connectVersion.equals(currentVersion)) { mergeToClientQueue(startResend); } else {
/** * Detect if the whole delta is an echo back. If it is then take it as if it was an ack. * Echo back is a result of reconnection/recovery. * @return If the delta is a echo back. * @throws TransformException */ private boolean detectEchoBack(TransformedWaveletDelta serverDelta) throws TransformException { // We have got all the initial list of operations. So do nothing. if (endOfStartingDelta == null || endOfStartingDelta.getVersion() <= serverDelta.getAppliedAtVersion()) { return false; } // Check to see if we are getting a delta that was sent by us, in case the // server echos back our own delta from a recovery scenario. if (unacknowledged != null && DeltaPair.areSame(serverDelta, unacknowledged)) { // If we completely match then take it as an ack. onSuccess(serverDelta.size(), serverDelta.getResultingVersion()); return true; } // We've just got to the end of the initial list of operations // and there is no match. That means we need to merge the unacknowledged // ops and resend again. if (endOfStartingDelta.equals(serverDelta.getResultingVersion())) { mergeToClientQueue(inferredServerPath.size()); } return false; }