-/** \ingroup msg_gos_functions
-* \brief This function wait for the first completed communication
-*
-* It takes on parameter.
-* \param comms a vector of communication
-* \return the position of the completed communication, if any, or -1 if none was completed
-*/
-int MSG_comm_testany(xbt_dynar_t comms)
-{
- return SIMIX_req_comm_testany(comms);
+/**
+ * \ingroup msg_gos_functions
+ * \brief Returns the error (if any) that occured during a finished communication.
+ * \param comm a finished communication
+ * \return the status of the communication, or MSG_OK if the communication
+ * was successfully completed
+ */
+MSG_error_t MSG_comm_get_status(msg_comm_t comm) {
+
+ MSG_error_t result;
+ e_smx_state_t smx_state = SIMIX_req_comm_get_state(comm);
+
+ switch (smx_state) {
+
+ case SIMIX_CANCELED:
+ result = MSG_TASK_CANCELLED;
+ break;
+
+ case SIMIX_FAILED:
+ case SIMIX_SRC_HOST_FAILURE:
+ case SIMIX_DST_HOST_FAILURE:
+ result = MSG_HOST_FAILURE;
+ break;
+
+ case SIMIX_LINK_FAILURE:
+ result = MSG_TRANSFER_FAILURE;
+ break;
+
+ case SIMIX_SRC_TIMEOUT:
+ case SIMIX_DST_TIMEOUT:
+ result = MSG_TIMEOUT;
+ break;
+
+ default:
+ result = MSG_OK;
+ break;
+ }
+ return result;