Commit 370769d2 authored by Shane Snyder's avatar Shane Snyder

add margo_hg_info_get_instance call

parent 740a04f5
......@@ -638,6 +638,15 @@ hg_class_t* margo_get_class(margo_instance_id mid);
*/
margo_instance_id margo_hg_handle_get_instance(hg_handle_t h);
/**
* Get the margo_instance_id from a received RPC handle.
*
* \param [in] info RPC info structure pointer
*
* \return Margo instance
*/
margo_instance_id margo_hg_info_get_instance(const struct hg_info *info);
/**
* Maps an RPC id and mplex id to the pool that it should execute on
* @param [in] mid Margo instance
......
......@@ -928,6 +928,11 @@ margo_instance_id margo_hg_handle_get_instance(hg_handle_t h)
{
const struct hg_info* info = HG_Get_info(h);
if(!info) return MARGO_INSTANCE_NULL;
return margo_hg_info_get_instance(info);
}
margo_instance_id margo_hg_info_get_instance(const struct hg_info *info)
{
struct margo_rpc_data* data =
(struct margo_rpc_data*) HG_Registered_data(info->hg_class, info->id);
if(!data) return MARGO_INSTANCE_NULL;
......
......@@ -46,10 +46,9 @@ static void my_rpc_ult(hg_handle_t handle)
assert(buffer);
/* get handle info and margo instance */
/* TODO: how can we avoid calling get_info twice? */
hgi = margo_get_info(handle);
assert(hgi);
mid = margo_hg_handle_get_instance(handle);
mid = margo_hg_info_get_instance(hgi);
assert(mid != MARGO_INSTANCE_NULL);
/* register local target buffer for bulk access */
......@@ -97,10 +96,9 @@ static void my_rpc_shutdown_ult(hg_handle_t handle)
printf("Got RPC request to shutdown\n");
/* get handle info and margo instance */
/* TODO: how can we avoid calling get_info twice? */
hgi = margo_get_info(handle);
assert(hgi);
mid = margo_hg_handle_get_instance(handle);
mid = margo_hg_info_get_instance(hgi);
assert(mid != MARGO_INSTANCE_NULL);
hret = margo_respond(mid, handle, NULL);
......@@ -136,10 +134,9 @@ static void my_rpc_hang_ult(hg_handle_t handle)
out.ret = 0;
/* get handle info and margo instance */
/* TODO: how can we avoid calling get_info twice? */
hgi = margo_get_info(handle);
assert(hgi);
mid = margo_hg_handle_get_instance(handle);
mid = margo_hg_info_get_instance(hgi);
assert(mid != MARGO_INSTANCE_NULL);
/* sleep for an hour (to allow client to test timeout capability) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment