Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Really tiny optimization when the communication is failed already
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 22 Jan 2022 23:44:53 +0000 (00:44 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 22 Jan 2022 23:44:53 +0000 (00:44 +0100)
src/surf/network_cm02.cpp

index edcfb57..3c24efa 100644 (file)
@@ -316,11 +316,10 @@ bool NetworkCm02Model::comm_get_route_info(const s4u::Host* src, const s4u::Host
 
   bool failed = std::any_of(route.begin(), route.end(), [](const StandardLinkImpl* link) { return not link->is_on(); });
 
-  if (cfg_crosstraffic) {
+  if (not failed && cfg_crosstraffic) {
     dst->route_to(src, back_route, nullptr);
-    if (not failed)
-      failed = std::any_of(back_route.begin(), back_route.end(),
-                           [](const StandardLinkImpl* link) { return not link->is_on(); });
+    failed = std::any_of(back_route.begin(), back_route.end(),
+                         [](const StandardLinkImpl* link) { return not link->is_on(); });
   }
   return failed;
 }