-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
}
} while (got_answer == 0);
- /* Second step: Send a FIND_NODE to a a random node in buckets */
+ /* Second step: Send a FIND_NODE to a random node in buckets */
unsigned int bucket_id = routing_table_find_bucket(node->table, id_known)->id;
xbt_assert(bucket_id <= IDENTIFIER_SIZE);
for (i = 0; ((bucket_id > i) || (bucket_id + i) <= IDENTIFIER_SIZE) && i < JOIN_BUCKETS_QUERIES; i++) {
*/
answer_t find_closest(const_node_t node, unsigned int destination_id)
{
- int i;
answer_t answer = answer_init(destination_id);
/* We find the corresponding bucket for the id */
const_bucket_t bucket = routing_table_find_bucket(node->table, destination_id);
/* 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.
*/
- for (i = 1; answer->size < BUCKET_SIZE && ((bucket_id - i > 0) || (bucket_id + i < IDENTIFIER_SIZE)); i++) {
+ for (int i = 1; answer->size < BUCKET_SIZE && ((bucket_id - i > 0) || (bucket_id + i < IDENTIFIER_SIZE)); i++) {
/* We check the previous buckets */
if (bucket_id - i >= 0) {
const_bucket_t bucket_p = &node->table->buckets[bucket_id - i];
unsigned int find_node(node_t node, unsigned int id_to_find, unsigned int count_in_stats)
{
- unsigned int i = 0;
unsigned int queries;
unsigned int answers;
unsigned int destination_found = 0;
// Handle the answer
routing_table_update(node, msg->sender_id);
node_contact_t contact;
+ unsigned int i;
xbt_dynar_foreach (node_list->nodes, i, contact)
routing_table_update(node, contact->id);
if (prefix == 0) {
return 0;
} else {
- return (1U << ((unsigned int)(prefix - 1))) ^ id;
+ return (1U << (prefix - 1)) ^ id;
}
}