Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
No need to rebuild the parser if you're not a maintainer.
[simgrid.git] / src / surf / network.c
index 278237d..9a59eaf 100644 (file)
@@ -269,19 +269,19 @@ static void update_actions_state(double now, double delta)
     deltap = delta;
     if (action->latency > 0) {
       if (action->latency > deltap) {
-       action->latency -= deltap;
+       surf_double_update(&(action->latency),deltap);
        deltap = 0.0;
       } else {
-       deltap -= action->latency;
+       surf_double_update(&(deltap), action->latency);
        action->latency = 0.0;
       }
       if ((action->latency == 0.0) && !(action->suspended)) 
        lmm_update_variable_weight(maxmin_system, action->variable, 1.0);
     }
-    action->generic_action.remains -=
-       lmm_variable_getvalue(action->variable) * deltap;
+    surf_double_update(&(action->generic_action.remains),
+       lmm_variable_getvalue(action->variable) * deltap);
     if (action->generic_action.max_duration != NO_MAX_DURATION)
-      action->generic_action.max_duration -= delta;
+      surf_double_update(&(action->generic_action.max_duration), delta);
 
     /*   if(action->generic_action.remains<.00001) action->generic_action.remains=0; */
 
@@ -403,6 +403,10 @@ static surf_action_t communicate(void *src, void *dst, double size, double rate)
     lmm_update_variable_bound(maxmin_system, action->variable,
                              min(action->rate,SG_TCP_CTE_GAMMA / action->lat_current));
 
+  if(route_size == 0) {
+    surf_action_change_state((surf_action_t) action, SURF_ACTION_DONE);
+  }
+
   for (i = 0; i < route_size; i++)
     lmm_expand(maxmin_system, route[i]->constraint, action->variable, 1.0);