Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Many const to remove a mutable (TODO--).
[simgrid.git] / src / kernel / routing / ClusterZone.cpp
index ea7267b456b4efce7a61ba1fe00ede292027ae70..e49e486ba24c6dff965b879f117032528d019e4f 100644 (file)
@@ -17,7 +17,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf"
 namespace simgrid {
 namespace kernel {
 namespace routing {
-ClusterZone::ClusterZone(NetZoneImpl* father, std::string name, resource::NetworkModel* netmodel)
+ClusterZone::ClusterZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel)
     : NetZoneImpl(father, name, netmodel)
 {
 }
@@ -29,12 +29,14 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg
              "Cluster routing: no links attached to the source node - did you use host_link tag?");
 
   if ((src->id() == dst->id()) && has_loopback_) {
-    xbt_assert(not src->is_router(), "Routing from a cluster private router to itself is meaningless");
-
-    std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
-    route->link_list.push_back(info.first);
-    if (lat)
-      *lat += info.first->get_latency();
+    if (src->is_router()) {
+      XBT_WARN("Routing from a cluster private router to itself is meaningless");
+    } else {
+      std::pair<resource::LinkImpl*, resource::LinkImpl*> info = private_links_.at(node_pos(src->id()));
+      route->link_list.push_back(info.first);
+      if (lat)
+        *lat += info.first->get_latency();
+    }
     return;
   }