char pred_mailbox[MAILBOX_NAME_SIZE]; // predecessor's mailbox name
int next_finger_to_fix; // index of the next finger to fix in fix_fingers()
msg_comm_t comm_receive; // current communication to receive
char pred_mailbox[MAILBOX_NAME_SIZE]; // predecessor's mailbox name
int next_finger_to_fix; // index of the next finger to fix in fix_fingers()
msg_comm_t comm_receive; // current communication to receive
node.id = atoi(argv[1]);
get_mailbox(node.id, node.mailbox);
node.next_finger_to_fix = 0;
node.id = atoi(argv[1]);
get_mailbox(node.id, node.mailbox);
node.next_finger_to_fix = 0;
node.fingers = xbt_new0(s_finger_t, nb_bits);
node.last_change_date = init_time;
node.fingers = xbt_new0(s_finger_t, nb_bits);
node.last_change_date = init_time;
while ((index = MSG_comm_testany(node.comms)) != -1) {
comm_send = xbt_dynar_get_as(node.comms, index, msg_comm_t);
MSG_error_t status = MSG_comm_get_status(comm_send);
while ((index = MSG_comm_testany(node.comms)) != -1) {
comm_send = xbt_dynar_get_as(node.comms, index, msg_comm_t);
MSG_error_t status = MSG_comm_get_status(comm_send);
static void handle_task(node_t node, m_task_t task) {
DEBUG1("Handling task %p", task);
static void handle_task(node_t node, m_task_t task) {
DEBUG1("Handling task %p", task);
char mailbox[MAILBOX_NAME_SIZE];
task_data_t task_data = (task_data_t) MSG_task_get_data(task);
e_task_type_t type = task_data->type;
char mailbox[MAILBOX_NAME_SIZE];
task_data_t task_data = (task_data_t) MSG_task_get_data(task);
e_task_type_t type = task_data->type;
task_data->issuer_host_name,
task_data->answer_to,
task_data->request_id, task_data->answer_id);
task_data->issuer_host_name,
task_data->answer_to,
task_data->request_id, task_data->answer_id);
- comm = MSG_task_isend(task, task_data->answer_to);
- xbt_dynar_push(node->comms, &comm);
+ MSG_task_dsend(task, task_data->answer_to);
DEBUG2("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
task_data->request_id, closest);
get_mailbox(closest, mailbox);
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);
+ MSG_task_dsend(task, mailbox);
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);
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);
+ MSG_task_dsend(task, task_data->answer_to);
DEBUG2("Sending a 'Notify' request (task %p) to %d", task, notify_id);
char mailbox[MAILBOX_NAME_SIZE];
get_mailbox(notify_id, mailbox);
DEBUG2("Sending a 'Notify' request (task %p) to %d", task, notify_id);
char mailbox[MAILBOX_NAME_SIZE];
get_mailbox(notify_id, mailbox);
- msg_comm_t comm = MSG_task_isend(task, mailbox);
- xbt_dynar_push(node->comms, &comm);
+ MSG_task_dsend(task, mailbox);