-/* Copyright (c) 2012-2021. The SimGrid Team.
+/* Copyright (c) 2012-2023. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
} while (!answerGot && trials < Common.MAX_JOIN_TRIALS);
/* Second step: Send a FIND_NODE in a node in each bucket */
int bucketId = table.findBucket(idKnown).getId();
- for (int i = 0; ((bucketId - i) > 0 ||
- (bucketId + i) <= Common.IDENTIFIER_SIZE) &&
+ for (int i = 0; ((bucketId - i) > 0 ||
+ (bucketId + i) <= Common.IDENTIFIER_SIZE) &&
i < Common.JOIN_BUCKETS_QUERIES; i++) {
if (bucketId - i > 0) {
int idInBucket = table.getIdInPrefix(this.id,bucketId - i);
if (!comm.test()) {
waitFor(1);
} else {
- Task task = comm.getTask();
+ Task task = comm.getTask();
if (task instanceof FindNodeAnswerTask) {
FindNodeAnswerTask answerTask = (FindNodeAnswerTask)task;
//Check if we received what we are looking for.
table.update(c.getId());
}
answers++;
-
+
nodesAdded = nodeList.merge(answerTask.getAnswer());
} else {
/* If it's not our answer, we answer to the node that has queried us anyway */
}
} while (answers < queries && Msg.getClock() < timeout);
destinationFound = nodeList.destinationFound();
- } while (!destinationFound && (nodesAdded > 0 || answers == 0) && Msg.getClock() < globalTimeout
+ } while (!destinationFound && (nodesAdded > 0 || answers == 0) && Msg.getClock() < globalTimeout
&& steps < Common.MAX_STEPS);
if (destinationFound) {