Commit c6dd1a84 authored by Shane Snyder's avatar Shane Snyder
Browse files

more changes to swim api

parent 4a25aed1
......@@ -130,6 +130,7 @@ static int ssg_get_swim_dping_target(
hg_addr_t *target_addr);
static int ssg_get_swim_iping_targets(
void *group_data,
int *num_targets,
swim_member_id_t *target_ids,
hg_addr_t *target_addrs);
static void ssg_get_swim_member_addr(
......@@ -160,7 +161,11 @@ static int ssg_get_swim_dping_target(
/* if current member list is empty, generate a new random one */
if (g->member_list == NULL)
{
ssg_gen_rand_member_list(g);
if(g->member_list == NULL)
return -1;
}
/* pull random member off head of list and return addr */
target_ms = g->member_list;
......@@ -171,19 +176,6 @@ static int ssg_get_swim_dping_target(
return 0;
}
static int ssg_get_swim_iping_targets(
void *group_data,
swim_member_id_t *target_id,
hg_addr_t *target_addrs)
{
ssg_group_t *g = (ssg_group_t *)group_data;
assert(g != NULL);
return 0;
}
static void ssg_gen_rand_member_list(ssg_group_t *g)
{
ssg_member_state_t *ms, *tmp;
......@@ -197,6 +189,22 @@ static void ssg_gen_rand_member_list(ssg_group_t *g)
return;
}
static int ssg_get_swim_iping_targets(
void *group_data,
int *num_targets,
swim_member_id_t *target_id,
hg_addr_t *target_addrs)
{
ssg_group_t *g = (ssg_group_t *)group_data;
int max_targets = *num_targets;
assert(g != NULL);
*num_targets = 0;
return 0;
}
static void ssg_get_swim_member_addr(
void *group_data,
swim_member_id_t id,
......@@ -209,7 +217,7 @@ static void ssg_get_swim_member_addr(
assert(g != NULL);
HASH_FIND(hh, g->view.member_map, &ssg_id, sizeof(ssg_member_id_t), ms);
/* XXX ASSERT */
assert(ms != NULL);
*addr = ms->addr;
......@@ -228,7 +236,7 @@ static void ssg_get_swim_member_state(
assert(g != NULL);
HASH_FIND(hh, g->view.member_map, &ssg_id, sizeof(ssg_member_id_t), ms);
/* XXX ASSERT */
assert(ms != NULL);
*state = &ms->swim_state;
......@@ -1201,21 +1209,12 @@ static int ssg_group_view_create(
if (strcmp(self_addr_substr, addr_substr) == 0)
{
hret = margo_addr_dup(ssg_inst->mid, self_addr, &tmp_ms->addr);
if (hret != HG_SUCCESS)
{
free(tmp_ms->addr_str);
free(tmp_ms);
goto fini;
}
if (self_id)
*self_id = tmp_ms->id;
/* XXX: add self state to membership view? or somewhere static? */
//HASH_ADD(hh, view->member_map, id, sizeof(ssg_member_id_t), tmp_ms);
/* don't look up our own address, we already know it */
free(tmp_ms->addr_str);
free(tmp_ms);
continue;
}
}
......
......@@ -192,8 +192,10 @@ static void swim_tick_ult(
if(!(swim_ctx->ping_target_acked) && (swim_ctx->prot_subgroup_sz > 0))
{
/* get a random subgroup of members to send indirect pings to */
int iping_target_count = swim_ctx->swim_callbacks.get_iping_targets(
swim_ctx->group_data, swim_ctx->iping_target_ids, swim_ctx->iping_target_addrs);
int iping_target_count = swim_ctx->prot_subgroup_sz;
swim_ctx->swim_callbacks.get_iping_targets(
swim_ctx->group_data, &iping_target_count, swim_ctx->iping_target_ids,
swim_ctx->iping_target_addrs);
if(iping_target_count == 0)
{
/* no available subgroup members, back out */
......
......@@ -58,7 +58,7 @@ typedef struct swim_group_mgmt_callbacks
* @param[out] target_id ID of selected direct ping target
* @param[out] inc_nr SWIM incarnation number of target
* @param[out] target_addr HG address of target
* @returns 1 on successful selection of a target, 0 if no targets available
* @returns 0 on successful selection of a target, -1 if no available targets
*/
int (*get_dping_target)(
void *group_data,
......@@ -71,12 +71,16 @@ typedef struct swim_group_mgmt_callbacks
* management layer to send indirect ping requests to.
*
* @param[in] group_data void pointer to group managment data
* @param[in/out] num_targets on input, maximum number of indirect ping
* targets to select. on output, the actual
* number of selected targets
* @param[out] target_ids IDs of selected indirect ping targets
* @param[out] target_addrs HG addresses of targets
* @returns number of selected indirect ping targets, 0 if no targets available
* @returns 0 on successful selection of targets, -1 if no available targets
*/
int (*get_iping_targets)(
void *group_data,
int *num_targets,
swim_member_id_t *target_ids,
hg_addr_t *target_addrs
);
......
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