extern long int smx_total_comms;
-/**
+/*
* Finger element.
*/
typedef struct s_finger {
char mailbox[MAILBOX_NAME_SIZE]; // string representation of the id
} s_finger_t, *finger_t;
-/**
+/*
* Node data.
*/
typedef struct s_node {
TASK_PREDECESSOR_LEAVING
} e_task_type_t;
-/**
+/*
* Data attached with the tasks sent and received
*/
typedef struct s_task_data {
// process functions
static int node(int argc, char *argv[]);
-static void handle_task(node_t node, m_task_t task);
+static void handle_task(node_t node, msg_task_t task);
// Chord core
static void create(node_t node);
}
double init_time = MSG_get_clock();
- m_task_t task_received = NULL;
+ msg_task_t task_received = NULL;
int i;
int join_success = 0;
double deadline;
// a transfer has occured
- MSG_error_t status = MSG_comm_get_status(node.comm_receive);
+ msg_error_t status = MSG_comm_get_status(node.comm_receive);
if (status != MSG_OK) {
XBT_DEBUG("Failed to receive a task. Nevermind.");
* \param task the task to handle (don't touch it then:
* it will be destroyed, reused or forwarded)
*/
-static void handle_task(node_t node, m_task_t task) {
+static void handle_task(node_t node, msg_task_t task) {
XBT_DEBUG("Handling task %p", task);
char mailbox[MAILBOX_NAME_SIZE];
node->pred_id, to_mailbox);
req_data->type = TASK_SUCCESSOR_LEAVING;
}
- m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
//char* mailbox = get_mailbox(to_mailbox);
msg_comm_t comm = MSG_task_isend(task, to_mailbox);
xbt_dynar_push(node->comms, &comm);
req_data->issuer_host_name = MSG_host_get_name(MSG_host_self());
// send a "Find Successor" request to ask_to_id
- m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
XBT_DEBUG("Sending a 'Find Successor' request (task %p) to %d for id %d", task_sent, ask_to, id);
- MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
+ msg_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
if (res != MSG_OK) {
XBT_DEBUG("Failed to send the 'Find Successor' request (task %p) to %d for id %d",
do {
if (node->comm_receive == NULL) {
- m_task_t task_received = NULL;
+ msg_task_t task_received = NULL;
node->comm_receive = MSG_task_irecv(&task_received, node->mailbox);
}
node->comm_receive = NULL;
}
else {
- m_task_t task_received = MSG_comm_get_task(node->comm_receive);
+ msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
XBT_DEBUG("Received a task (%p)", task_received);
task_data_t ans_data = MSG_task_get_data(task_received);
// send a "Get Predecessor" request to ask_to_id
XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to);
- m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
- MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
+ msg_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, timeout);
if (res != MSG_OK) {
XBT_DEBUG("Failed to send the 'Get Predecessor' request (task %p) to %d",
do {
if (node->comm_receive == NULL) { // FIXME simplify this
- m_task_t task_received = NULL;
+ msg_task_t task_received = NULL;
node->comm_receive = MSG_task_irecv(&task_received, node->mailbox);
}
node->comm_receive = NULL;
}
else {
- m_task_t task_received = MSG_comm_get_task(node->comm_receive);
+ msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
task_data_t ans_data = MSG_task_get_data(task_received);
if (MC_IS_ENABLED) {
req_data->issuer_host_name = MSG_host_get_name(MSG_host_self());
// send a "Notify" request to notify_id
- m_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
+ msg_task_t task = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data);
XBT_DEBUG("Sending a 'Notify' request (task %p) to %d", task, notify_id);
char mailbox[MAILBOX_NAME_SIZE];
get_mailbox(notify_id, mailbox);
MSG_function_register("node", node);
MSG_launch_application(application_file);
- MSG_error_t res = MSG_main();
+ msg_error_t res = MSG_main();
XBT_CRITICAL("Messages created: %ld", smx_total_comms);
XBT_INFO("Simulated time: %g", MSG_get_clock());