Commit 5b444d4f authored by Matthieu Dorier's avatar Matthieu Dorier

fixed handle cache issue using HG_Ref_get

parent 9a51493d
......@@ -733,6 +733,13 @@ hg_return_t margo_destroy(hg_handle_t handle)
if(handle == HG_HANDLE_NULL)
return HG_SUCCESS;
/* check if the reference count of the handle is 1 */
int32_t refcount = HG_Ref_get(handle);
if(refcount != 1) {
/* if different from 1, then HG_Destroy will simply decrease it */
return HG_Destroy(handle);
}
margo_instance_id mid;
hg_return_t hret = HG_OTHER_ERROR;
......
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