X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/11c89cce51496fc517db7fc3485de5ba2b328217..4d36514184049d76bf323bdaa53da15b5d1a4c6b:/examples/s4u/dht-chord/s4u-dht-chord.hpp diff --git a/examples/s4u/dht-chord/s4u-dht-chord.hpp b/examples/s4u/dht-chord/s4u-dht-chord.hpp index a5fff65eb7..50e7f602c3 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord.hpp +++ b/examples/s4u/dht-chord/s4u-dht-chord.hpp @@ -161,9 +161,12 @@ public: } now = simgrid::s4u::Engine::getClock(); } - if (comm_receive != nullptr) - comm_receive->cancel(); - delete static_cast(data); + if (comm_receive != nullptr) { + if (comm_receive->test()) + delete static_cast(data); + else + comm_receive->cancel(); + } // leave the ring leave(); }