]> AND Public Git Repository - simgrid.git/blobdiff - src/surf/HostImpl.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix memory leak with ns3 routing tables.
[simgrid.git] / src / surf / HostImpl.cpp
index f105aa5b1c1843f2926c5cb729c573cc67ed732b..9dabe15b660df6fd8261e6c79942a922170dbc1e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2013-2022. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -99,6 +99,16 @@ void HostImpl::turn_off(const actor::ActorImpl* issuer)
               actor.get_host()->get_cname(), issuer->get_cname());
     issuer->kill(&actor);
   }
+  for (const auto& activity : EngineImpl::get_instance()->get_maestro()->activities_) {
+    auto* exec = dynamic_cast<activity::ExecImpl*>(activity.get());
+    if (exec != nullptr) {
+      auto hosts = exec->get_hosts();
+      if (std::find(hosts.begin(), hosts.end(), &piface_) != hosts.end()) {
+        exec->cancel();
+        exec->set_state(activity::State::FAILED);
+      }
+    }
+  }
   // When a host is turned off, we want to keep only the actors that should restart for when it will boot again.
   // Then get rid of the others.
   auto elm = remove_if(begin(actors_at_boot_), end(actors_at_boot_), [](const actor::ProcessArg* arg) {