Commit d7ebf492 authored by Matthieu Dorier's avatar Matthieu Dorier

added a function to check if the RPC is registered with a given multiplex id

parent f1720209
...@@ -174,6 +174,24 @@ hg_return_t margo_registered_name( ...@@ -174,6 +174,24 @@ hg_return_t margo_registered_name(
hg_id_t *id, hg_id_t *id,
hg_bool_t *flag); hg_bool_t *flag);
/**
* Indicate whether the given RPC name has been registered with the given multiplex id.
*
* @param [in] mid Margo instance
* @param [in] func_name function name
* @param [in] mplex_id multiplex id
* @param [out] id registered RPC ID
* @param [out] flag pointer to boolean
*
* @return HG_SUCCESS or corresponding HG error code
*/
hg_return_t margo_registered_name_mplex(
margo_instance_id mid,
const char *func_name,
uint32_t mplex_id,
hg_id_t *id,
hg_bool_t *flag);
/** /**
* Register and associate user data to registered function. * Register and associate user data to registered function.
* When HG_Finalize() is called free_callback (if defined) is called * When HG_Finalize() is called free_callback (if defined) is called
......
...@@ -507,6 +507,37 @@ hg_return_t margo_registered_name(margo_instance_id mid, const char *func_name, ...@@ -507,6 +507,37 @@ hg_return_t margo_registered_name(margo_instance_id mid, const char *func_name,
return(HG_Registered_name(mid->hg_class, func_name, id, flag)); return(HG_Registered_name(mid->hg_class, func_name, id, flag));
} }
hg_return_t margo_registered_name_mplex(margo_instance_id mid, const char *func_name,
uint32_t mplex_id, hg_id_t *id, hg_bool_t *flag)
{
int b;
hg_return_t ret = margo_registered_name(mid, func_name, id, &b);
if(ret != HG_SUCCESS)
return ret;
if((!b) || (!mplex_id)) {
*flag = b;
return ret;
}
struct mplex_key key;
struct mplex_element *element;
memset(&key, 0, sizeof(key));
key.id = *id;
key.mplex_id = mplex_id;
HASH_FIND(hh, mid->mplex_table, &key, sizeof(key), element);
if(!element) {
*flag = 0;
return HG_SUCCESS;
}
assert(element->key.id == id && element->key.mplex_id == mplex_id);
*flag = 1;
return HG_SUCCESS;
}
hg_return_t margo_register_data( hg_return_t margo_register_data(
margo_instance_id mid, margo_instance_id mid,
hg_id_t id, hg_id_t id,
......
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