static void flux_rpc_usecount_decr (flux_rpc_t *rpc) { if (!rpc) return; assert (rpc->magic == RPC_MAGIC); if (--rpc->usecount == 0) { if (rpc->w) { flux_msg_handler_stop (rpc->w); flux_msg_handler_destroy (rpc->w); } if (rpc->m.matchtag != FLUX_MATCHTAG_NONE) { /* FIXME: we cannot safely return matchtags to the pool here * if the rpc was not completed. Lacking a proper cancellation * protocol, we simply leak them. See issue #212. */ if (rpc->rx_count >= rpc->rx_expected) flux_matchtag_free (rpc->h, rpc->m.matchtag); } flux_msg_destroy (rpc->rx_msg); if (rpc->aux && rpc->aux_destroy) rpc->aux_destroy (rpc->aux); rpc->magic =~ RPC_MAGIC; free (rpc); } }
static void flux_rpc_usecount_decr (flux_rpc_t *rpc) { if (rpc && --rpc->usecount == 0) { if (rpc->w) { flux_msg_handler_stop (rpc->w); flux_msg_handler_destroy (rpc->w); } if (rpc->m.matchtag != FLUX_MATCHTAG_NONE) { /* FIXME: we cannot safely return matchtags to the pool here * if the rpc was not completed. Lacking a proper cancellation * protocol, we simply leak them. See issue #212. */ if (flux_rpc_completed (rpc)) flux_matchtag_free (rpc->h, rpc->m.matchtag, rpc->m.bsize); } flux_msg_destroy (rpc->rx_msg); flux_msg_destroy (rpc->rx_msg_consumed); if (rpc->nodemap) free (rpc->nodemap); if (rpc->aux && rpc->aux_destroy) rpc->aux_destroy (rpc->aux); free (rpc); } }