XBT_DEBUG("Found a matching communication synchro %p", comm);
if (remove_matching)
deque->erase(it);
- comm = static_cast<simgrid::kernel::activity::CommImpl*>(SIMIX_comm_ref(comm));
+ SIMIX_comm_ref(comm);
#if SIMGRID_HAVE_MC
comm->mbox_cpy = comm->mbox;
#endif
other_comm = this_synchro;
mbox->push(this_synchro);
} else {
- if(other_comm->surf_comm && other_comm->remains() < 1e-12) {
+ if (other_comm->surf_comm && other_comm->remains() < 1e-12) {
XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",other_comm);
other_comm->state = SIMIX_DONE;
other_comm->type = SIMIX_COMM_DONE;
other_comm = this_synchro;
mbox->push(this_synchro);
} else {
- SIMIX_comm_unref(this_synchro);
+ XBT_DEBUG("Match my %p with the existing %p", this_synchro, other_comm);
+
other_comm = static_cast<simgrid::kernel::activity::CommImpl*>(other_comm);
other_comm->state = SIMIX_READY;
other_comm->type = SIMIX_COMM_READY;
+ SIMIX_comm_unref(this_synchro);
+ SIMIX_comm_unref(this_synchro);
}
dst_proc->comms.push_back(other_comm);
}
simgrid::s4u::Host* sender = comm->src_proc->host;
simgrid::s4u::Host* receiver = comm->dst_proc->host;
- XBT_DEBUG("Starting communication %p from '%s' to '%s'", synchro, sender->cname(), receiver->cname());
-
comm->surf_comm = surf_network_model->communicate(sender, receiver, comm->task_size, comm->rate);
comm->surf_comm->setData(synchro);
comm->state = SIMIX_RUNNING;
+ XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p)", synchro, sender->cname(),
+ receiver->cname(), comm->surf_comm);
+
/* If a link is failed, detect it immediately */
if (comm->surf_comm->getState() == simgrid::surf::Action::State::failed) {
XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", sender->cname(),
/* If the synchro is still in a rendez-vous point then remove from it */
if (comm->mbox)
- comm->mbox->remove(synchro);
+ comm->mbox->remove(comm);
XBT_DEBUG("SIMIX_comm_finish: synchro state = %d", (int)synchro->state);