diff --git a/include/margo.h b/include/margo.h index a5f75876f1dbdb86a58e6d2a147197d22a6b38b1..f23f44c9cc8753dee629956219044176747da342 100644 --- a/include/margo.h +++ b/include/margo.h @@ -115,6 +115,16 @@ void margo_finalize( void margo_wait_for_finalize( margo_instance_id mid); +/** + * Checks whether a Margo instance we initialized as a server. + * + * @param [in] mid Margo instance + * + * @return HG_TRUE if listening or HG_FALSE if not, or not a valid margo instance. + */ +hg_bool_t margo_is_listening( + margo_instance_id mid); + /** * Installs a callback to be called before the margo instance is finalize. * Callbacks installed will be called in reverse ordered than they have been @@ -291,6 +301,20 @@ hg_return_t margo_registered_disable_response( hg_id_t id, int disable_flag); +/** + * Checks if response is disabled for a given RPC ID. + * + * @param [in] mid Margo instance + * @param [in] id registered function ID + * @param [ou] disabled_flag flag indicating whether response is disabled (1) or not (0) + * + * @return HG_SUCCESS or corresponding HG error code + */ +hg_return_t margo_registered_disabled_response( + margo_instance_id mid, + hg_id_t id, + int* disabled_flag); + /** * Lookup an addr from a peer address/name. * \param [in] name lookup name diff --git a/src/margo.c b/src/margo.c index ea73fc2cceb8da0a595351c601f63d34fbab930e..dcf36f343073dddd48eb4a95bbc35ac5f61add12 100644 --- a/src/margo.c +++ b/src/margo.c @@ -486,6 +486,13 @@ void margo_wait_for_finalize(margo_instance_id mid) return; } +hg_bool_t margo_is_listening( + margo_instance_id mid) +{ + if(!mid) return HG_FALSE; + return HG_Class_is_listening(mid->hg_class); +} + void margo_push_finalize_callback( margo_instance_id mid, void(*cb)(void*), @@ -613,6 +620,18 @@ hg_return_t margo_registered_disable_response( return(HG_Registered_disable_response(mid->hg_class, id, disable_flag)); } +hg_return_t margo_registered_disabled_response( + margo_instance_id mid, + hg_id_t id, + int* disabled_flag) +{ + hg_bool_t b; + hg_return_t ret = HG_Registered_disabled_response(mid->hg_class, id, &b); + if(ret != HG_SUCCESS) return ret; + *disabled_flag = b; + return HG_SUCCESS; +} + struct lookup_cb_evt { hg_return_t hret;