- case TASK_FIND_SUCCESSOR:
- DEBUG2("Receiving a 'Find Successor' request from %s for id %d",
- task_data->issuer_host_name, task_data->request_id);
- // is my successor the successor?
- if (is_in_interval(task_data->request_id, node->id + 1, node->fingers[0].id)) {
- task_data->type = TASK_FIND_SUCCESSOR_ANSWER;
- task_data->answer_id = node->fingers[0].id;
- DEBUG3("Sending back a 'Find Successor Answer' to %s: the successor of %d is %d",
- task_data->issuer_host_name,
- task_data->request_id, task_data->answer_id);
- comm = MSG_task_isend(task, task_data->answer_to);
- xbt_dynar_push(node->comms, &comm);
- }
- else {
- // otherwise, forward the request to the closest preceding finger in my table
- int closest = closest_preceding_node(node, task_data->request_id);
- DEBUG2("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
- task_data->request_id, closest);
- get_mailbox(closest, mailbox);
- comm = MSG_task_isend(task, mailbox);
- xbt_dynar_push(node->comms, &comm);
- xbt_free(mailbox);
- }
- break;
-
- case TASK_GET_PREDECESSOR:
- DEBUG1("Receiving a 'Get Predecessor' request from %s", task_data->issuer_host_name);
- task_data->type = TASK_GET_PREDECESSOR_ANSWER;
- task_data->answer_id = node->pred_id;
- DEBUG3("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d",
- task_data->issuer_host_name,
- task_data->answer_to, task_data->answer_id);
- comm = MSG_task_isend(task, task_data->answer_to);
- xbt_dynar_push(node->comms, &comm);
- break;
-
- case TASK_NOTIFY:
- // someone is telling me that he may be my new predecessor
- DEBUG1("Receiving a 'Notify' request from %s", task_data->issuer_host_name);
- notify(node, task_data->request_id);
- task_data_destroy(task_data);
- MSG_task_destroy(task);
- break;
-
- case TASK_PREDECESSOR_LEAVING:
- // my predecessor is about to quit
- DEBUG1("Receiving a 'Predecessor Leaving' message from %s", task_data->issuer_host_name);
- // modify my predecessor
- set_predecessor(node, task_data->request_id);
- task_data_destroy(task_data);
- MSG_task_destroy(task);
- /*TODO :
+ case TASK_FIND_SUCCESSOR:
+ XBT_DEBUG("Receiving a 'Find Successor' request from %s for id %d",
+ task_data->issuer_host_name, task_data->request_id);
+ // is my successor the successor?
+ if (is_in_interval(task_data->request_id, node->id + 1, node->fingers[0].id)) {
+ task_data->type = TASK_FIND_SUCCESSOR_ANSWER;
+ task_data->answer_id = node->fingers[0].id;
+ XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d",
+ task_data->issuer_host_name,
+ task_data->answer_to,
+ task_data->request_id, task_data->answer_id);
+ MSG_task_dsend(task, task_data->answer_to, task_free);
+ }
+ else {
+ // otherwise, forward the request to the closest preceding finger in my table
+ int closest = closest_preceding_node(node, task_data->request_id);
+ XBT_DEBUG("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
+ task_data->request_id, closest);
+ get_mailbox(closest, mailbox);
+ MSG_task_dsend(task, mailbox, task_free);
+ }
+ break;
+
+ case TASK_GET_PREDECESSOR:
+ XBT_DEBUG("Receiving a 'Get Predecessor' request from %s", task_data->issuer_host_name);
+ task_data->type = TASK_GET_PREDECESSOR_ANSWER;
+ task_data->answer_id = node->pred_id;
+ XBT_DEBUG("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d",
+ task_data->issuer_host_name,
+ task_data->answer_to, task_data->answer_id);
+ MSG_task_dsend(task, task_data->answer_to, task_free);
+ break;
+
+ case TASK_NOTIFY:
+ // someone is telling me that he may be my new predecessor
+ XBT_DEBUG("Receiving a 'Notify' request from %s", task_data->issuer_host_name);
+ notify(node, task_data->request_id);
+ task_free(task);
+ break;
+
+ case TASK_PREDECESSOR_LEAVING:
+ // my predecessor is about to quit
+ XBT_DEBUG("Receiving a 'Predecessor Leaving' message from %s", task_data->issuer_host_name);
+ // modify my predecessor
+ set_predecessor(node, task_data->request_id);
+ task_free(task);
+ /*TODO :