static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type);
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
static smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type,
- int (*match_fun)(void *, void *,smx_action_t),
- void *user_data, smx_action_t my_action);
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *user_data, smx_action_t my_action);
static void SIMIX_rdv_free(void *data);
void SIMIX_network_init(void)
action, action->comm.refcount, (int)action->state);
if (action->comm.refcount <= 0) {
- xbt_backtrace_display_current();
- xbt_die("the refcount of comm %p is already 0 before decreasing it. "
- "That's a bug!", action);
+ xbt_backtrace_display_current();
+ xbt_die("The refcount of comm %p is already 0 before decreasing it. "
+ "That's a bug! If you didn't test and/or wait the same communication twice in your code, then the bug is SimGrid's...", action);
}
action->comm.refcount--;
if (action->comm.refcount > 0)
/* If a link is failed, detect it immediately */
if (surf_workstation_model->action_state_get(action->comm.surf_comm) == SURF_ACTION_FAILED) {
XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure",
- SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver));
+ SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver));
action->state = SIMIX_LINK_FAILURE;
SIMIX_comm_destroy_internal_actions(action);
}
if (SIMIX_process_is_suspended(action->comm.src_proc) ||
SIMIX_process_is_suspended(action->comm.dst_proc)) {
/* FIXME: check what should happen with the action state */
+
+ if (SIMIX_process_is_suspended(action->comm.src_proc))
+ XBT_DEBUG("The communication is suspended on startup because src (%s:%s) were suspended since it initiated the communication",
+ SIMIX_host_get_name(action->comm.src_proc->smx_host), action->comm.src_proc->name);
+ else
+ XBT_DEBUG("The communication is suspended on startup because dst (%s:%s) were suspended since it initiated the communication",
+ SIMIX_host_get_name(action->comm.dst_proc->smx_host), action->comm.dst_proc->name);
+
surf_workstation_model->suspend(action->comm.surf_comm);
+
}
}
}
case SIMIX_SRC_HOST_FAILURE:
if (simcall->issuer == action->comm.src_proc)
- SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
+ simcall->issuer->context->iwannadie = 1;
+// SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
else
SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed");
break;
case SIMIX_DST_HOST_FAILURE:
if (simcall->issuer == action->comm.dst_proc)
- SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
+ simcall->issuer->context->iwannadie = 1;
+// SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
else
SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed");
break;
}
}
+ if (surf_workstation_model->extension.
+ workstation.get_state(simcall->issuer->smx_host->host) != SURF_RESOURCE_ON) {
+ simcall->issuer->context->iwannadie = 1;
+ }
+
simcall->issuer->waiting_action = NULL;
xbt_fifo_remove(simcall->issuer->comms, action);
SIMIX_simcall_answer(simcall);
action->state = SIMIX_DST_HOST_FAILURE;
else if (action->comm.surf_comm &&
surf_workstation_model->action_state_get(action->comm.surf_comm) == SURF_ACTION_FAILED) {
- XBT_DEBUG("Puta madre. Surf says that the link broke");
+ XBT_DEBUG("Puta madre. Surf says that the link broke");
action->state = SIMIX_LINK_FAILURE;
} else
action->state = SIMIX_DONE;
void SIMIX_comm_suspend(smx_action_t action)
{
/*FIXME: shall we suspend also the timeout actions? */
- surf_workstation_model->suspend(action->comm.surf_comm);
+ if (action->comm.surf_comm)
+ surf_workstation_model->suspend(action->comm.surf_comm);
+ /* in the other case, the action will be suspended on creation, in SIMIX_comm_start() */
}
void SIMIX_comm_resume(smx_action_t action)
{
/*FIXME: check what happen with the timeouts */
- surf_workstation_model->resume(action->comm.surf_comm);
+ if (action->comm.surf_comm)
+ surf_workstation_model->resume(action->comm.surf_comm);
+ /* in the other case, the action were not really suspended yet, see SIMIX_comm_suspend() and SIMIX_comm_start() */
}
{
size_t buff_size = comm->comm.src_buff_size;
/* If there is no data to be copy then return */
- if (!comm->comm.src_buff || !comm->comm.dst_buff || comm->comm.copied == 1)
+ if (!comm->comm.src_buff || !comm->comm.dst_buff || comm->comm.copied)
return;
XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",