int[] versionReceived = new int[N];
int maxVerCounter = 0, oldVerCounter = 0;
//process replies to analyze if we get correct responses
for (int i = 0; i < rcs.replies.size(); i++) {
CloudReply r = rcs.replies.get(i);
if (r.response == null || r.type != DepSkySCloudManager.GET_DATA
|| r.vNumber == null || r.reg == null) {
nullResponses++;
//Fault check #1
if (nullResponses > N - F) {
throw new Exception("READ ERROR: DepSky-S DataUnit does not exist or client is offline (internet connection failed)");
} else if (nullResponses > F) {
//System.out.println(r.response + " \n" + r.type + " \n" + r.vNumber + " \n" + r.reg.toString());
throw new Exception("READ ERROR: at least f + 1 clouds failed");
}
} else {
Long maxVersionFound = r.reg.getMaxVersion();
//process replies
if (reg.isPVSS()) {
//Data Unit using PVSS (retuns when having f + 1 sequential replies with maxVersionFound)
if (r.reg.getMaxVersion()==null || maxVersionFound.longValue() == Long.parseLong(r.vNumber)) {
//have max version
versionReceived[i] = 1;
maxVerCounter++;
} else {
//have old version
versionReceived[i] = 2;
oldVerCounter++;
}
reg = r.reg;
} else {
//Data Unit NOT using PVSS (returns first reply with maxVersionFound in metadata)
if (maxVersionFound.longValue() == Long.parseLong(r.vNumber)) {
// reg.clearAllCaches();
lastReadRepliesMaxVerIdx = i;
return (byte[]) r.response;
}
}
}
}//for replies
//get the value of each response (each cloud could have differents blocks)
Share[] keyshares = new Share[N];
Map<String, byte[]> erasurec = new HashMap<>();
if(reg.isErsCodes() || reg.isSecSharing() || reg.isPVSS()){
for (int i = 0; i < rcs.replies.size(); i++) {
if (maxVerCounter >= T && versionReceived[i] != 1) {
CloudReply resp = rcs.replies.get(i);
resp.invalidateResponse();
} else if (oldVerCounter >= T && versionReceived[i] != 2) {
CloudReply resp = rcs.replies.get(i);
resp.invalidateResponse();
}
}
for (CloudReply r : rcs.replies) {
int i = 0;
if(r.response != null){