Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix NS3 and latency bound tracking
[simgrid.git] / src / simix / smx_network.c
index dd3660a..a30ee03 100644 (file)
@@ -445,7 +445,7 @@ smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
 
   if (MC_is_active()) {
     other_action->state = SIMIX_RUNNING;
-    return other_action;
+    return (detached ? NULL : other_action);
   }
 
   SIMIX_comm_start(other_action);
@@ -792,6 +792,7 @@ void SIMIX_comm_finish(smx_action_t action)
   unsigned int destroy_count = 0;
   smx_simcall_t simcall;
 
+
   while ((simcall = xbt_fifo_shift(action->simcalls))) {
 
     /* If a waitany simcall is waiting for this action to finish, then remove
@@ -890,13 +891,33 @@ void SIMIX_comm_finish(smx_action_t action)
     simcall->issuer->waiting_action = NULL;
     xbt_fifo_remove(simcall->issuer->comms, action);
     if(action->comm.detached){
+      smx_process_t proc;
+      int still_alive = 0;
+
       if(simcall->issuer == action->comm.src_proc){
-        if(action->comm.dst_proc)
-          xbt_fifo_remove(action->comm.dst_proc->comms, action);
+        if(action->comm.dst_proc){
+            xbt_swag_foreach(proc, simix_global->process_list)
+            {
+               if(proc==action->comm.dst_proc){
+                   still_alive=1;
+                   break;
+               }
+            }
+        }
+        if(still_alive) xbt_fifo_remove(action->comm.dst_proc->comms, action);
       }
       if(simcall->issuer == action->comm.dst_proc){
         if(action->comm.src_proc)
-          xbt_fifo_remove(action->comm.src_proc->comms, action);
+          if(action->comm.dst_proc){
+            xbt_swag_foreach(proc, simix_global->process_list)
+            {
+              if(proc==action->comm.src_proc){
+                  still_alive=1;
+                  break;
+              }
+            }
+          }
+          if(still_alive) xbt_fifo_remove(action->comm.src_proc->comms, action);
       }
     }
     SIMIX_simcall_answer(simcall);
@@ -1091,7 +1112,7 @@ XBT_INLINE int SIMIX_comm_is_latency_bounded(smx_action_t action)
   }
   if (action->comm.surf_comm){
     XBT_DEBUG("Getting latency limited for surf_action (%p)", action->comm.surf_comm);
-    action->latency_limited = surf_workstation_model->get_latency_limited(action->comm.surf_comm);
+    action->latency_limited = surf_network_action_get_latency_limited(action->comm.surf_comm);
     XBT_DEBUG("Action limited is %d", action->latency_limited);
   }
   return action->latency_limited;