diff --git a/src/mercury.c b/src/mercury.c index 05d63796..a3462274 100644 --- a/src/mercury.c +++ b/src/mercury.c @@ -289,9 +289,11 @@ hg_handle_create(struct hg_private_class *hg_class) /* CRC32 is enough for small size buffers */ ret = hg_proc_create((hg_class_t *) hg_class, hash, &hg_handle->in_proc); HG_CHECK_SUBSYS_HG_ERROR(rpc, error, ret, "Cannot create HG proc"); + hg_proc_set_handle(hg_handle->in_proc, &hg_handle->handle); ret = hg_proc_create((hg_class_t *) hg_class, hash, &hg_handle->out_proc); HG_CHECK_SUBSYS_HG_ERROR(rpc, error, ret, "Cannot create HG proc"); + hg_proc_set_handle(hg_handle->out_proc, &hg_handle->handle); return hg_handle; diff --git a/src/mercury_proc.h b/src/mercury_proc.h index 85621511..9efdc586 100644 --- a/src/mercury_proc.h +++ b/src/mercury_proc.h @@ -256,6 +256,26 @@ hg_proc_reset(hg_proc_t proc, void *buf, hg_size_t buf_size, hg_proc_op_t op); static HG_INLINE hg_class_t * hg_proc_get_class(hg_proc_t proc); +/** + * Associate an HG handle with the processor. + * + * \param proc [IN] abstract processor object + * \param handle [IN] HG handle + * + */ +static HG_INLINE void +hg_proc_set_handle(hg_proc_t proc, hg_handle_t handle); + +/** + * Get the HG handle associated to the processor. + * + * \param proc [IN] abstract processor object + * + * \return HG handle + */ +static HG_INLINE hg_handle_t +hg_proc_get_handle(hg_proc_t proc); + /** * Get the operation type associated to the processor. * @@ -588,6 +608,7 @@ struct hg_proc { struct hg_proc_buf proc_buf; struct hg_proc_buf extra_buf; hg_class_t *hg_class; /* HG class */ + hg_handle_t handle; /* HG handle */ struct hg_proc_buf *current_buf; #ifdef HG_HAS_CHECKSUMS struct mchecksum_object *checksum; /* Checksum */ @@ -605,6 +626,20 @@ hg_proc_get_class(hg_proc_t proc) return ((struct hg_proc *) proc)->hg_class; } +/*---------------------------------------------------------------------------*/ +static HG_INLINE void +hg_proc_set_handle(hg_proc_t proc, hg_handle_t handle) +{ + ((struct hg_proc *) proc)->handle = handle; +} + +/*---------------------------------------------------------------------------*/ +static HG_INLINE hg_handle_t +hg_proc_get_handle(hg_proc_t proc) +{ + return ((struct hg_proc *) proc)->handle; +} + /*---------------------------------------------------------------------------*/ static HG_INLINE hg_proc_op_t hg_proc_get_op(hg_proc_t proc)