X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c81ccd4a2401afbcd8fd8e3c58c68de73c1cf1f8..16678c8c9b1395b7b2a65ff845fbcdda775b3f44:/src/surf/HostImpl.cpp diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 73347dfe05..9dabe15b66 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -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,11 +99,14 @@ void HostImpl::turn_off(const actor::ActorImpl* issuer) actor.get_host()->get_cname(), issuer->get_cname()); issuer->kill(&actor); } - for (auto& activity : EngineImpl::get_instance()->get_maestro()->activities_) { + for (const auto& activity : EngineImpl::get_instance()->get_maestro()->activities_) { auto* exec = dynamic_cast(activity.get()); - if (exec != nullptr && exec->get_host() == &piface_) { - exec->cancel(); - exec->state_ = activity::State::FAILED; + 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.