Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move the host-on-off fix above
[simgrid.git] / src / simix / smx_network.c
index 6d1b849..42e07be 100644 (file)
@@ -777,7 +777,6 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
   unsigned int destroy_count = 0;
   smx_simcall_t simcall;
 
-
   while ((simcall = xbt_fifo_shift(synchro->simcalls))) {
 
     /* If a waitany simcall is waiting for this synchro to finish, then remove
@@ -801,6 +800,12 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
 
     /* Check out for errors */
 
+    if (surf_resource_get_state(surf_workstation_resource_priv(
+          simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
+      simcall->issuer->context->iwannadie = 1;
+      SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
+    } else
+
     switch (synchro->state) {
 
     case SIMIX_DONE:
@@ -836,14 +841,6 @@ void SIMIX_comm_finish(smx_synchro_t synchro)
 
     case SIMIX_LINK_FAILURE:
 
-      // There should be a cleaner way to do this.
-      // We should handle this in SIMIX_post_comm instead.
-      if (surf_resource_get_state(surf_workstation_resource_priv(
-            simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
-        SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
-        break;
-      }
-
       XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d",
                 synchro,
                 synchro->comm.src_proc ? sg_host_name(synchro->comm.src_proc->smx_host) : NULL,