Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Test comm before cancelation, and kill last leak in this test! \o/
[simgrid.git] / examples / s4u / dht-chord / s4u-dht-chord.hpp
index 04f0c22..50e7f60 100644 (file)
@@ -69,6 +69,8 @@ public:
   }
 
   ~ChordMessage() = default;
+
+  static void destroy(void* message);
 };
 
 class Node {
@@ -159,8 +161,11 @@ public:
       }
       now = simgrid::s4u::Engine::getClock();
     }
-    if (data != nullptr) {
-      delete static_cast<ChordMessage*>(data);
+    if (comm_receive != nullptr) {
+      if (comm_receive->test())
+        delete static_cast<ChordMessage*>(data);
+      else
+        comm_receive->cancel();
     }
     // leave the ring
     leave();