X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/877fd76c223fe2fba051129f3ba0339bb5566bce..12db8a46fc2350fc54dc04b12fc5580239ef23c4:/src/s4u/s4u_host.cpp diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 254dba7721..72c3dfcb37 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -10,6 +10,7 @@ #include +#include "simgrid/s4u/engine.hpp" #include "simgrid/s4u/host.hpp" #include "simgrid/s4u/storage.hpp" #include "simgrid/simix.hpp" @@ -43,7 +44,7 @@ simgrid::xbt::signal Host::onStateChange; Host::Host(const char* name) : name_(name) { - xbt_assert(sg_host_by_name(name) == nullptr, "Refusing to create a second host named '%s'.", name); + xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name); host_list[name_] = this; } @@ -52,8 +53,9 @@ Host::~Host() xbt_assert(currentlyDestroying_, "Please call h->destroy() instead of manually deleting it."); delete pimpl_; + if (pimpl_netcard != nullptr) // not removed yet by a children class + simgrid::s4u::Engine::instance()->netcardUnregister(pimpl_netcard); delete pimpl_cpu; - delete pimpl_netcard; delete mounts; } @@ -134,7 +136,7 @@ int Host::pstatesCount() const { */ void Host::routeTo(Host* dest, std::vector* links, double* latency) { - simgrid::kernel::routing::AsImpl::getGlobalRoute(pimpl_netcard, dest->pimpl_netcard, links, latency); + simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(pimpl_netcard, dest->pimpl_netcard, links, latency); if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) { XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", cname(), dest->cname(), (latency == nullptr ? -1 : *latency));