Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HG: associate handle to HG proc #745

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/mercury.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
35 changes: 35 additions & 0 deletions src/mercury_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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 */
Expand All @@ -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)
Expand Down
Loading