Commit c7262ef5 authored by Shane Snyder's avatar Shane Snyder

update tests/examples with new api changes

parent 22dc49c8
......@@ -122,18 +122,18 @@ int main(int argc, char **argv)
printf("Shutting down delegator server.\n");
hret = margo_create(mid, delegator_svr_addr, my_rpc_shutdown_id, &handle);
assert(hret == HG_SUCCESS);
hret = margo_forward(mid, handle, NULL);
hret = margo_forward(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
if(strcmp(argv[1], argv[2]))
{
sleep(3);
printf("Shutting down data_xfer server.\n");
hret = margo_create(mid, data_xfer_svr_addr, my_rpc_shutdown_id, &handle);
assert(hret == HG_SUCCESS);
hret = margo_forward(mid, handle, NULL);
hret = margo_forward(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
}
margo_addr_free(mid, delegator_svr_addr);
......
......@@ -62,7 +62,7 @@ void composed_read(margo_instance_id mid, hg_addr_t svr_addr, void *buffer, hg_s
/* Send rpc. Note that we are also transmitting the bulk handle in the
* input struct. It was set above.
*/
hret = margo_forward(mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -72,7 +72,7 @@ void composed_read(margo_instance_id mid, hg_addr_t svr_addr, void *buffer, hg_s
/* clean up resources consumed by this rpc */
margo_free_output(handle, &out);
margo_bulk_free(in.bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
return;
}
......@@ -112,7 +112,7 @@ void data_xfer_read(margo_instance_id mid, hg_addr_t svr_addr, void *buffer, hg_
/* Send rpc. Note that we are also transmitting the bulk handle in the
* input struct. It was set above.
*/
hret = margo_forward(mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -122,7 +122,7 @@ void data_xfer_read(margo_instance_id mid, hg_addr_t svr_addr, void *buffer, hg_
/* clean up resources consumed by this rpc */
margo_free_output(handle, &out);
margo_bulk_free(in.bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
margo_addr_free(mid, addr_self);
return;
......
......@@ -33,10 +33,10 @@ static void my_rpc_shutdown_ult(hg_handle_t handle)
mid = margo_hg_handle_get_instance(handle);
assert(mid != MARGO_INSTANCE_NULL);
hret = margo_respond(mid, handle, NULL);
hret = margo_respond(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
/* NOTE: we assume that the server daemon is using
* margo_wait_for_finalize() to suspend until this RPC executes, so there
......
......@@ -63,10 +63,10 @@ static void data_xfer_read_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
return;
}
......
......@@ -61,7 +61,7 @@ static void delegator_read_ult(hg_handle_t handle)
hret = margo_addr_to_string(mid, client_addr_string, &client_addr_string_sz, hgi->addr);
assert(hret == HG_SUCCESS);
in_relay.client_addr = client_addr_string;
hret = margo_forward(mid, handle_relay, &in_relay);
hret = margo_forward(handle_relay, &in_relay);
assert(hret == HG_SUCCESS);
hret = margo_get_output(handle_relay, &out_relay);
......@@ -70,12 +70,12 @@ static void delegator_read_ult(hg_handle_t handle)
margo_free_input(handle, &in);
margo_free_output(handle_relay, &out);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_addr_free(mid, data_xfer_svc_addr);
margo_destroy(mid, handle);
margo_destroy(mid, handle_relay);
margo_destroy(handle);
margo_destroy(handle_relay);
return;
}
......
......@@ -140,10 +140,10 @@ int main(int argc, char **argv)
hret = margo_create(mid, svr_addr, my_rpc_shutdown_id, &handle);
assert(hret == HG_SUCCESS);
hret = margo_forward(mid, handle, NULL);
hret = margo_forward(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
margo_addr_free(mid, svr_addr);
/* shut down everything */
......@@ -184,7 +184,7 @@ static void run_my_rpc(void *_arg)
* input struct. It was set above.
*/
in.input_val = arg->val;
hret = margo_forward(arg->mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -196,7 +196,7 @@ static void run_my_rpc(void *_arg)
/* clean up resources consumed by this rpc */
margo_bulk_free(in.bulk_handle);
margo_free_output(handle, &out);
margo_destroy(arg->mid, handle);
margo_destroy(handle);
free(buffer);
printf("ULT [%d] done.\n", arg->val);
......
......@@ -73,10 +73,10 @@ int main(int argc, char **argv)
hret = margo_create(mid, svr_addr, my_rpc_shutdown_id, &handle);
assert(hret == HG_SUCCESS);
hret = margo_forward(mid, handle, NULL);
hret = margo_forward(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
margo_addr_free(mid, svr_addr);
/* shut down everything */
......
......@@ -33,10 +33,10 @@ static void my_rpc_shutdown_ult(hg_handle_t handle)
mid = margo_hg_handle_get_instance(handle);
assert(mid != MARGO_INSTANCE_NULL);
hret = margo_respond(mid, handle, NULL);
hret = margo_respond(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
/* NOTE: we assume that the server daemon is using
* margo_wait_for_finalize() to suspend until this RPC executes, so there
......
......@@ -60,7 +60,7 @@ void svc1_do_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mplex_id)
* input struct. It was set above.
*/
in.input_val = 0;
hret = margo_forward(mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -70,7 +70,7 @@ void svc1_do_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mplex_id)
/* clean up resources consumed by this rpc */
margo_free_output(handle, &out);
margo_bulk_free(in.bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......@@ -106,7 +106,7 @@ void svc1_do_other_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mpl
* input struct. It was set above.
*/
in.input_val = 0;
hret = margo_forward(mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -116,7 +116,7 @@ void svc1_do_other_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mpl
/* clean up resources consumed by this rpc */
margo_free_output(handle, &out);
margo_bulk_free(in.bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......
......@@ -56,11 +56,11 @@ static void svc1_do_thing_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_bulk_free(bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......@@ -114,11 +114,11 @@ static void svc1_do_other_thing_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_bulk_free(bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......
......@@ -59,7 +59,7 @@ void svc2_do_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mplex_id)
* input struct. It was set above.
*/
in.input_val = 0;
hret = margo_forward(mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -69,7 +69,7 @@ void svc2_do_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mplex_id)
/* clean up resources consumed by this rpc */
margo_free_output(handle, &out);
margo_bulk_free(in.bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......@@ -105,7 +105,7 @@ void svc2_do_other_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mpl
* input struct. It was set above.
*/
in.input_val = 0;
hret = margo_forward(mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -115,7 +115,7 @@ void svc2_do_other_thing(margo_instance_id mid, hg_addr_t svr_addr, uint32_t mpl
/* clean up resources consumed by this rpc */
margo_free_output(handle, &out);
margo_bulk_free(in.bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......
......@@ -56,11 +56,11 @@ static void svc2_do_thing_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_bulk_free(bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......@@ -114,11 +114,11 @@ static void svc2_do_other_thing_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_bulk_free(bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......
......@@ -76,11 +76,11 @@ static void my_rpc_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_bulk_free(bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......@@ -90,21 +90,18 @@ DEFINE_MARGO_RPC_HANDLER(my_rpc_ult)
static void my_rpc_shutdown_ult(hg_handle_t handle)
{
hg_return_t hret;
const struct hg_info *hgi;
margo_instance_id mid;
printf("Got RPC request to shutdown\n");
/* get handle info and margo instance */
hgi = margo_get_info(handle);
assert(hgi);
mid = margo_hg_info_get_instance(hgi);
mid = margo_hg_handle_get_instance(handle);
assert(mid != MARGO_INSTANCE_NULL);
hret = margo_respond(mid, handle, NULL);
hret = margo_respond(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
margo_diag_dump(mid, "-", 0);
......
......@@ -141,10 +141,10 @@ int main(int argc, char **argv)
hret = margo_create(mid, svr_addr, my_rpc_shutdown_id, &handle);
assert(hret == HG_SUCCESS);
hret = margo_forward_timed(mid, handle, NULL, 2000.0);
hret = margo_forward_timed(handle, NULL, 2000.0);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
margo_addr_free(mid, svr_addr);
/* shut down everything */
......@@ -185,7 +185,7 @@ static void run_my_rpc(void *_arg)
*/
in.input_val = arg->val;
/* call with 2 second timeout */
hret = margo_forward_timed(arg->mid, handle, &in, 2000.0);
hret = margo_forward_timed(handle, &in, 2000.0);
if(hret == HG_SUCCESS)
{
......@@ -202,7 +202,7 @@ static void run_my_rpc(void *_arg)
/* clean up resources consumed by this rpc */
margo_bulk_free(in.bulk_handle);
margo_destroy(arg->mid, handle);
margo_destroy(handle);
free(buffer);
printf("ULT [%d] done.\n", arg->val);
......
......@@ -139,10 +139,10 @@ int main(int argc, char **argv)
hret = margo_create(mid, svr_addr, my_rpc_shutdown_id, &handle);
assert(hret == HG_SUCCESS);
hret = margo_forward(mid, handle, NULL);
hret = margo_forward(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
margo_addr_free(mid, svr_addr);
/* shut down everything */
......@@ -182,7 +182,7 @@ static void run_my_rpc(void *_arg)
* input struct. It was set above.
*/
in.input_val = arg->val;
hret = margo_forward(arg->mid, handle, &in);
hret = margo_forward(handle, &in);
assert(hret == HG_SUCCESS);
/* decode response */
......@@ -194,7 +194,7 @@ static void run_my_rpc(void *_arg)
/* clean up resources consumed by this rpc */
margo_bulk_free(in.bulk_handle);
margo_free_output(handle, &out);
margo_destroy(arg->mid, handle);
margo_destroy(handle);
free(buffer);
printf("ULT [%d] done.\n", arg->val);
......
......@@ -76,11 +76,11 @@ static void my_rpc_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_bulk_free(bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......@@ -90,21 +90,18 @@ DEFINE_MARGO_RPC_HANDLER(my_rpc_ult)
static void my_rpc_shutdown_ult(hg_handle_t handle)
{
hg_return_t hret;
const struct hg_info *hgi;
margo_instance_id mid;
printf("Got RPC request to shutdown\n");
/* get handle info and margo instance */
hgi = margo_get_info(handle);
assert(hgi);
mid = margo_hg_info_get_instance(hgi);
mid = margo_hg_handle_get_instance(handle);
assert(mid != MARGO_INSTANCE_NULL);
hret = margo_respond(mid, handle, NULL);
hret = margo_respond(handle, NULL);
assert(hret == HG_SUCCESS);
margo_destroy(mid, handle);
margo_destroy(handle);
/* NOTE: we assume that the server daemon is using
* margo_wait_for_finalize() to suspend until this RPC executes, so there
......@@ -160,11 +157,11 @@ static void my_rpc_hang_ult(hg_handle_t handle)
margo_free_input(handle, &in);
hret = margo_respond(mid, handle, &out);
hret = margo_respond(handle, &out);
assert(hret == HG_SUCCESS);
margo_bulk_free(bulk_handle);
margo_destroy(mid, handle);
margo_destroy(handle);
free(buffer);
return;
......
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