- if (host_number == 0){ //root: send then receive
- sprintf(mailbox, "%d", host_number+1);
- task = MSG_task_create("Token", task_comp_size, task_comm_size, NULL);
- XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"",host_number,task->name,mailbox);
+ if (rank == 0){ /* - The root (rank 0) first sends the token then waits to receive it back */
+ snprintf(mailbox,255, "%d", rank+1);
+ task = MSG_task_create("Token", 0, task_comm_size, NULL);
+ XBT_INFO("Host \"%d\" send '%s' to Host \"%s\"", rank, task->name,mailbox);