/* Second step: Send a FIND_NODE to a a random node in buckets */
unsigned int bucket_id = table->findBucket(known_id)->getId();
/* Second step: Send a FIND_NODE to a a random node in buckets */
unsigned int bucket_id = table->findBucket(known_id)->getId();
- xbt_assert(bucket_id <= identifier_size);
- for (i = 0; ((bucket_id > i) || (bucket_id + i) <= identifier_size) && i < JOIN_BUCKETS_QUERIES; i++) {
+ xbt_assert(bucket_id <= IDENTIFIER_SIZE);
+ for (i = 0; ((bucket_id > i) || (bucket_id + i) <= IDENTIFIER_SIZE) && i < JOIN_BUCKETS_QUERIES; i++) {
if (bucket_id > i) {
unsigned int id_in_bucket = get_id_in_prefix(id_, bucket_id - i);
findNode(id_in_bucket, false);
}
if (bucket_id > i) {
unsigned int id_in_bucket = get_id_in_prefix(id_, bucket_id - i);
findNode(id_in_bucket, false);
}
unsigned int id_in_bucket = get_id_in_prefix(id_, bucket_id + i);
findNode(id_in_bucket, false);
}
unsigned int id_in_bucket = get_id_in_prefix(id_, bucket_id + i);
findNode(id_in_bucket, false);
}
unsigned int j = 0;
unsigned int destination = node_list->getDestinationId();
for (auto node_to_query : node_list->nodes) {
unsigned int j = 0;
unsigned int destination = node_list->getDestinationId();
for (auto node_to_query : node_list->nodes) {
/* Gets the node we want to send the query to */
if (node_to_query.first != id_) { /* No need to query ourselves */
sendFindNode(node_to_query.first, destination);
j++;
}
i++;
/* Gets the node we want to send the query to */
if (node_to_query.first != id_) { /* No need to query ourselves */
sendFindNode(node_to_query.first, destination);
j++;
}
i++;
/* We find the corresponding bucket for the id */
Bucket* bucket = table->findBucket(destination_id);
int bucket_id = bucket->getId();
/* We find the corresponding bucket for the id */
Bucket* bucket = table->findBucket(destination_id);
int bucket_id = bucket->getId();
/* So, we copy the contents of the bucket unsigned into our answer */
answer->addBucket(bucket);
/* So, we copy the contents of the bucket unsigned into our answer */
answer->addBucket(bucket);
- /* However, if we don't have enough elements in our bucket, we NEED to include at least "bucket_size" elements
- * (if, of course, we know at least "bucket_size" elements. So we're going to look unsigned into the other buckets.
+ /* However, if we don't have enough elements in our bucket, we NEED to include at least "BUCKET_SIZE" elements
+ * (if, of course, we know at least "BUCKET_SIZE" elements. So we're going to look unsigned into the other buckets.
/* We check the previous buckets */
if (bucket_id - i >= 0) {
Bucket* bucket_p = table->buckets[bucket_id - i];
answer->addBucket(bucket_p);
}
/* We check the next buckets */
/* We check the previous buckets */
if (bucket_id - i >= 0) {
Bucket* bucket_p = table->buckets[bucket_id - i];
answer->addBucket(bucket_p);
}
/* We check the next buckets */