- // if we have a sender, we should use its data, and not the data from the receive
- //FIXME : may fail if req->action has already been freed, the pointer being invalid
- if((req->action)&&
- (req->src==MPI_ANY_SOURCE || req->tag== MPI_ANY_TAG))
- //req = (MPI_Request)SIMIX_comm_get_src_data((*request)->action);
-
- if(status != MPI_STATUS_IGNORE) {
- status->MPI_SOURCE = req->src;
- status->MPI_TAG = req->tag;
- //if((*request)->action && ((MPI_Request)SIMIX_comm_get_src_data((*request)->action))->size == (*request)->size)
- status->MPI_ERROR = MPI_SUCCESS;
- //else status->MPI_ERROR = MPI_ERR_TRUNCATE;
- // this handles the case were size in receive differs from size in send
- // FIXME: really this should just contain the count of receive-type blocks,
- // right?
- status->count = req->size;
- }
- req = *request;
-
- print_request("Finishing", req);
- MPI_Datatype datatype = req->old_type;
- if(datatype->has_subtype == 1){
- // This part handles the problem of non-contignous memory
- // the unserialization at the reception
- s_smpi_subtype_t *subtype = datatype->substruct;
- if(req->flags & RECV) {
- subtype->unserialize(req->buf, req->old_buf, req->size/smpi_datatype_size(datatype) , datatype->substruct);
- }
- if(req->detached == 0) free(req->buf);
- }
-
-
-
- if(req->flags & NON_PERSISTENT) {
- if(req->flags & RECV &&
- req->action &&
- (req->action->state == SIMIX_DONE))
- {
- MPI_Request sender_request = (MPI_Request)SIMIX_comm_get_src_data(req->action);
- if((sender_request!=MPI_REQUEST_NULL) &&
- ( sender_request->detached ) &&
- ( sender_request->flags & RECV_DELETE))
- {
- //we are in a receiver's wait from a detached send
- //we have to clean the sender's side request here.... but only if done by a send, not an isend
- //the request lives senderside for an isend. As detached is currently for send + isend, we use RECV_DELETE to separate them
- //FIXME : see if just removing detached status for isend is also good
- smpi_mpi_request_free(&sender_request);
- }
+ if(!(req->detached && req->flags & SEND)){
+ if(status != MPI_STATUS_IGNORE) {
+ status->MPI_SOURCE = req->src == MPI_ANY_SOURCE ? req->real_src : req->src;
+ status->MPI_TAG = req->tag == MPI_ANY_TAG ? req->real_tag : req->tag;
+ if(req->truncated)
+ status->MPI_ERROR = MPI_ERR_TRUNCATE;
+ else status->MPI_ERROR = MPI_SUCCESS ;
+ // this handles the case were size in receive differs from size in send
+ // FIXME: really this should just contain the count of receive-type blocks,
+ // right?
+ status->count = req->real_size;