From 2676c8cf61874c4378ed699e3ca056636a4e152b Mon Sep 17 00:00:00 2001 From: Matthieu Dorier Date: Fri, 26 Oct 2018 16:08:20 -0500 Subject: [PATCH] added margo_registered_disabled_respone and margo_is_listening --- include/margo.h | 24 ++++++++++++++++++++++++ src/margo.c | 19 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/include/margo.h b/include/margo.h index a5f7587..f23f44c 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 ea73fc2..dcf36f3 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; -- 2.26.2