Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't access a task that failed to be received
[simgrid.git] / examples / msg / chord / chord.c
index dc3914c..6bccfd4 100644 (file)
@@ -9,6 +9,7 @@
 #include "msg/msg.h"
 #include "xbt/log.h"
 #include "xbt/asserts.h"
+#include "mc/modelchecker.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chord,
                              "Messages specific for this msg example");
 
@@ -255,7 +256,7 @@ static void set_predecessor(node_t node, int predecessor_id)
 int node(int argc, char *argv[])
 {
   double init_time = MSG_get_clock();
-  m_task_t task = NULL;
+  /*m_task_t task = NULL;*/
   m_task_t task_received = NULL;
   msg_comm_t comm_send = NULL;
   int i;
@@ -367,7 +368,7 @@ int node(int argc, char *argv[])
     }
 
     // clean unfinished comms sent
-    unsigned int cursor;
+   /* unsigned int cursor;
     xbt_dynar_foreach(node.comms, cursor, comm_send) {
       task = MSG_comm_get_task(comm_send);
       MSG_task_cancel(task);
@@ -375,7 +376,7 @@ int node(int argc, char *argv[])
       MSG_task_destroy(task);
       MSG_comm_destroy(comm_send);
       // FIXME: the task is actually not destroyed because MSG thinks that the other side (whose process is dead) is still using it
-    }
+    }*/
 
     // leave the ring
     leave(&node);
@@ -641,6 +642,8 @@ static int remote_find_successor(node_t node, int ask_to, int id)
         DEBUG1("Received a task (%p)", task_received);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
+        MC_assert(task_received == task_sent);
+
         if (task_received != task_sent) {
           // this is not the expected answer
           handle_task(node, task_received);
@@ -716,6 +719,8 @@ static int remote_get_predecessor(node_t node, int ask_to)
         m_task_t task_received = MSG_comm_get_task(node->comm_receive);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
+        MC_assert(task_received == task_sent);
+
         if (task_received != task_sent) {
           handle_task(node, task_received);
         }