Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move the latency computation logic from surf models to the routing module.
[simgrid.git] / src / surf / network.c
index 51a46e1..30792cf 100644 (file)
@@ -537,12 +537,14 @@ static surf_action_t net_communicate(const char *src_name,
      Add a link_CM02_t *link and a int link_nb to network_card_CM02_t. It will represent local links for this node
      Use the cluster_id for ->id */
 
-  xbt_dynar_t route = global_routing->get_route(src_name, dst_name);
   xbt_dynar_t back_route = NULL;
   int constraints_per_variable = 0;
+  // I will need this route for some time so let's call get_route_no_cleanup
+  xbt_dynar_t route = global_routing->get_route_no_cleanup(src_name, dst_name);
+
 
   if (sg_network_fullduplex == 1) {
-    back_route = global_routing->get_route(src_name, dst_name);
+    back_route = global_routing->get_route(dst_name, src_name);
   }
 
   /* LARGE PLATFORMS HACK:
@@ -658,6 +660,7 @@ static surf_action_t net_communicate(const char *src_name,
   strncpy(action->dst_name, dst_name, strlen(dst_name) + 1);
 #endif
 
+  xbt_dynar_free(&route);
   XBT_OUT;
 
   return (surf_action_t) action;
@@ -770,7 +773,8 @@ static void surf_network_model_init_internal(void)
                        net_link_new(xbt_strdup("__loopback__"),
                                     498000000, NULL, 0.000015, NULL,
                                     SURF_RESOURCE_ON, NULL,
-                                    SURF_LINK_FATPIPE, NULL));
+                                    SURF_LINK_FATPIPE, NULL),
+                        (double_f_pvoid_t)net_get_link_latency);
 }