Commit 3ef030f4 authored by Philip Carns's avatar Philip Carns

Merge branch 'dev-addr-lookup'

parents 95bdea25 a0799a63
...@@ -213,7 +213,7 @@ static void run_my_rpc(void *_arg) ...@@ -213,7 +213,7 @@ static void run_my_rpc(void *_arg)
sprintf((char*)buffer, "Hello world!\n"); sprintf((char*)buffer, "Hello world!\n");
/* find addr for server */ /* find addr for server */
ret = NA_Addr_lookup_wait(arg->network_class, "tcp://localhost:1234", &svr_addr); ret = margo_na_addr_lookup(arg->mid, arg->network_class, arg->na_context, "tcp://localhost:1234", &svr_addr);
assert(ret == 0); assert(ret == 0);
/* create handle */ /* create handle */
......
...@@ -83,6 +83,20 @@ hg_return_t margo_bulk_transfer( ...@@ -83,6 +83,20 @@ hg_return_t margo_bulk_transfer(
size_t local_offset, size_t local_offset,
size_t size); size_t size);
/**
* address lookup
* @param [in] na_class pointer to NA class
* @param [in] context pointer to context of execution
* @param [in] name lookup name
* @returns NA_SUCCESS on on success
*/
na_return_t margo_na_addr_lookup(
margo_instance_id mid,
na_class_t *na_class,
na_context_t *context,
const char *name,
na_addr_t *addr);
/** /**
* Retrive the Margo instance that has been associated with a Mercury class * Retrive the Margo instance that has been associated with a Mercury class
* @param [in] cl Mercury class * @param [in] cl Mercury class
......
...@@ -167,6 +167,7 @@ hg_return_t margo_forward( ...@@ -167,6 +167,7 @@ hg_return_t margo_forward(
return(hret); return(hret);
} }
static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_cb_info) static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_cb_info)
{ {
hg_return_t hret = hg_bulk_cb_info->ret; hg_return_t hret = hg_bulk_cb_info->ret;
...@@ -178,6 +179,59 @@ static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_ ...@@ -178,6 +179,59 @@ static hg_return_t margo_bulk_transfer_cb(const struct hg_bulk_cb_info *hg_bulk_
return(HG_SUCCESS); return(HG_SUCCESS);
} }
struct lookup_cb_evt
{
na_return_t nret;
na_addr_t addr;
};
static na_return_t margo_na_addr_lookup_cb(const struct na_cb_info *callback_info)
{
struct lookup_cb_evt evt;
evt.nret = callback_info->ret;
evt.addr = callback_info->info.lookup.addr;
ABT_eventual *eventual = callback_info->arg;
/* propagate return code out through eventual */
ABT_eventual_set(*eventual, &evt, sizeof(evt));
return(NA_SUCCESS);
}
na_return_t margo_na_addr_lookup(
margo_instance_id mid,
na_class_t *na_class,
na_context_t *context,
const char *name,
na_addr_t *addr)
{
na_return_t nret;
struct lookup_cb_evt *evt;
ABT_eventual eventual;
int ret;
ret = ABT_eventual_create(sizeof(*evt), &eventual);
if(ret != 0)
{
return(HG_NOMEM_ERROR);
}
nret = NA_Addr_lookup(na_class, context, margo_na_addr_lookup_cb,
&eventual, name, NA_OP_ID_IGNORE);
if(nret == 0)
{
ABT_eventual_wait(eventual, (void**)&evt);
*addr = evt->addr;
nret = evt->nret;
}
ABT_eventual_free(&eventual);
return(nret);
}
hg_return_t margo_bulk_transfer( hg_return_t margo_bulk_transfer(
margo_instance_id mid, margo_instance_id mid,
hg_bulk_context_t *context, hg_bulk_context_t *context,
......
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