+ name = xbt_str_join_array(action, " ");
+
+ /* The next chunk is to deal with the fact that for short messages,
+ * if the send occurs before the receive, the message is already sent and
+ * buffered on receiver side when the recv() occurs.
+ *
+ * So the next chunk detects this fact and cancel the simix communication instead.
+ */
+
+ /* make sure the rdv is created on need by asking to MSG instead of simix directly */
+ smx_rdv_t rdv = MSG_mailbox_get_by_alias(mailbox_name);
+ smx_action_t act = SIMIX_comm_get_send_match(rdv, task_sent_matching, NULL);
+ if (act!=NULL){
+ /* FIXME account for the memcopy time if needed */
+ task = act->comm.src_data;
+
+ if (task->simdata->message_size < 65536) {
+ act->comm.refcount--; /* See action_send for more pain */
+ if(act->state == SIMIX_DONE)
+ SIMIX_comm_finish(act);
+ else
+ SIMIX_req_comm_wait(act, -1.0);
+ return;
+ }
+ }