+ 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->action){
+ //if we want to free our request, we have to invalidate it at the other end of the comm
+ if(req->flags & SEND){
+ req->action->comm.src_data=MPI_REQUEST_NULL;
+ }else{
+ req->action->comm.dst_data=MPI_REQUEST_NULL;
+ }
+
+ smx_action_t temp=req->action;
+ if(req->action->comm.refcount == 1)req->action = NULL;
+ SIMIX_comm_destroy(temp);
+ }
+
+
+