Commit 3e561879 authored by Matthieu Dorier's avatar Matthieu Dorier

adapted to new shutdown feature in Margo

parent 8f187425
......@@ -28,7 +28,6 @@ struct mobject_client {
hg_id_t mobject_write_op_rpc_id;
hg_id_t mobject_read_op_rpc_id;
hg_id_t mobject_shutdown_rpc_id;
uint64_t num_provider_handles;
};
......@@ -70,7 +69,6 @@ static int mobject_client_register(mobject_client_t client, margo_instance_id mi
margo_registered_name(mid, "mobject_write_op", &client->mobject_write_op_rpc_id, &flag);
margo_registered_name(mid, "mobject_read_op", &client->mobject_read_op_rpc_id, &flag);
margo_registered_name(mid, "mobject_shutdown", &client->mobject_shutdown_rpc_id, &flag);
} else {
......@@ -78,8 +76,6 @@ static int mobject_client_register(mobject_client_t client, margo_instance_id mi
MARGO_REGISTER(mid, "mobject_write_op", write_op_in_t, write_op_out_t, NULL);
client->mobject_read_op_rpc_id =
MARGO_REGISTER(mid, "mobject_read_op", read_op_in_t, read_op_out_t, NULL);
client->mobject_shutdown_rpc_id =
MARGO_REGISTER(mid, "mobject_shutdown", void, void, NULL);
}
return 0;
......@@ -161,27 +157,7 @@ int mobject_provider_handle_release(mobject_provider_handle_t handle)
int mobject_shutdown(mobject_client_t client, hg_addr_t addr)
{
hg_return_t hret;
hg_handle_t handle;
hret = margo_create(client->mid, addr,
client->mobject_shutdown_rpc_id, &handle);
if(hret != HG_SUCCESS) {
fprintf(stderr, "[MOBJECT] margo_create() failed in mobject_shutdown()\n");
return -1;
}
hret = margo_forward(handle, NULL);
if(hret != HG_SUCCESS)
{
fprintf(stderr, "[MOBJECT] margo_forward() failed in mobject_shutdown()\n");
margo_destroy(handle);
return -1;
}
margo_destroy(handle);
return 0;
return margo_shutdown_remote_instance(client->mid, addr);
}
int mobject_write_op_operate(
......
......@@ -50,6 +50,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Error: Unable to initialize margo\n");
return -1;
}
margo_enable_remote_shutdown(mid);
/* SSG initialization */
ret = ssg_init(mid);
......
......@@ -34,7 +34,6 @@
DECLARE_MARGO_RPC_HANDLER(mobject_write_op_ult)
DECLARE_MARGO_RPC_HANDLER(mobject_read_op_ult)
DECLARE_MARGO_RPC_HANDLER(mobject_shutdown_ult)
static void mobject_finalize_cb(void* data);
......@@ -127,11 +126,6 @@ int mobject_provider_register(
mplex_id, pool);
margo_register_data_mplex(mid, rpc_id, mplex_id, srv_ctx, NULL);
rpc_id = MARGO_REGISTER_MPLEX(mid, "mobject_shutdown",
void, void, mobject_shutdown_ult,
mplex_id, pool);
margo_register_data_mplex(mid, rpc_id, mplex_id, srv_ctx, NULL);
margo_push_finalize_callback(mid, mobject_finalize_cb, (void*)srv_ctx);
*provider = srv_ctx;
......@@ -241,25 +235,6 @@ static hg_return_t mobject_read_op_ult(hg_handle_t h)
}
DEFINE_MARGO_RPC_HANDLER(mobject_read_op_ult)
static void mobject_shutdown_ult(hg_handle_t h)
{
hg_return_t ret;
const struct hg_info *info = margo_get_info(h);
margo_instance_id mid = margo_hg_handle_get_instance(h);
ret = margo_respond(h, NULL);
assert(ret == HG_SUCCESS);
ret = margo_destroy(h);
assert(ret == HG_SUCCESS);
margo_finalize(mid);
return;
}
DEFINE_MARGO_RPC_HANDLER(mobject_shutdown_ult)
static void mobject_finalize_cb(void* data)
{
mobject_provider_t srv_ctx = (mobject_provider_t)data;
......
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