} while (not got_answer);
/* Second step: Send a FIND_NODE to a a random node in buckets */
- unsigned int bucket_id = table->findBucket(known_id)->getId();
+ 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++) {
if (bucket_id > i) {
void Node::routingTableUpdate(unsigned int id)
{
// retrieval of the bucket in which the should be
- Bucket* bucket = table->findBucket(id);
+ Bucket* bucket = table.findBucket(id);
// check if the id is already in the bucket.
auto id_pos = std::find(bucket->nodes.begin(), bucket->nodes.end(), id);
{
Answer* answer = new Answer(destination_id);
/* We find the corresponding bucket for the id */
- Bucket* bucket = table->findBucket(destination_id);
+ const Bucket* bucket = table.findBucket(destination_id);
int bucket_id = bucket->getId();
xbt_assert((bucket_id <= IDENTIFIER_SIZE), "Bucket found has a wrong identifier");
/* So, we copy the contents of the bucket unsigned into our answer */
for (int i = 1; answer->getSize() < BUCKET_SIZE && ((bucket_id - i > 0) || (bucket_id + i < IDENTIFIER_SIZE)); i++) {
/* We check the previous buckets */
if (bucket_id - i >= 0) {
- Bucket* bucket_p = table->buckets[bucket_id - i];
+ const Bucket* bucket_p = &table.buckets[bucket_id - i];
answer->addBucket(bucket_p);
}
/* We check the next buckets */
if (bucket_id + i <= IDENTIFIER_SIZE) {
- Bucket* bucket_n = table->buckets[bucket_id + i];
+ const Bucket* bucket_n = &table.buckets[bucket_id + i];
answer->addBucket(bucket_n);
}
}
nodes_added = node_list->merge(msg->answer_);
XBT_DEBUG("Received an answer from %s (%s) with %zu nodes on it", msg->answer_to_->get_cname(),
- msg->issuer_host_name_, msg->answer_->nodes.size());
+ msg->issuer_host_name_.c_str(), msg->answer_->nodes.size());
} else {
if (msg->answer_) {
routingTableUpdate(msg->sender_id_);
{
routingTableUpdate(msg->sender_id_);
XBT_VERB("Received a FIND_NODE from %s (%s), he's trying to find %08x", msg->answer_to_->get_cname(),
- msg->issuer_host_name_, msg->destination_id_);
+ msg->issuer_host_name_.c_str(), msg->destination_id_);
// Building the answer to the request
Message* answer =
new Message(id_, msg->destination_id_, findClosest(msg->destination_id_),