Commit 87766b48 authored by Shane Snyder's avatar Shane Snyder

view serialization accounts for dead members now

parent 79a16bd0
......@@ -262,7 +262,7 @@ static int ssg_group_view_serialize(
unsigned int i;
hg_size_t view_size = 0;
int tmp_size;
void *view_buf, *p;
void *view_buf, *buf_p, *str_p;
*buf = NULL;
*buf_size = 0;
......@@ -270,19 +270,33 @@ static int ssg_group_view_serialize(
/* first determine view size */
for (i = 0; i < view->size; i++)
{
view_size += (strlen(view->member_states[i].addr_str) + 1);
if (view->member_states[i].addr_str)
view_size += (strlen(view->member_states[i].addr_str) + 1);
else
view_size += 1;
}
view_buf = malloc(view_size);
if(!view_buf)
return SSG_FAILURE;
p = view_buf;
buf_p = view_buf;
for (i = 0; i < view->size; i++)
{
tmp_size = strlen(view->member_states[i].addr_str) + 1;
memcpy(p, view->member_states[i].addr_str, tmp_size);
p += tmp_size;
char null = '\0';
if (view->member_states[i].addr_str)
{
tmp_size = strlen(view->member_states[i].addr_str) + 1;
str_p = view->member_states[i].addr_str;
}
else
{
tmp_size = 1;
str_p = &null;
}
memcpy(buf_p, str_p, tmp_size);
buf_p += tmp_size;
}
*buf = view_buf;
......
......@@ -737,11 +737,20 @@ void ssg_apply_membership_update(
ssg_group_t *g,
ssg_membership_update_t update)
{
if (!g) return;
hg_class_t *hgcl = NULL;
if(!ssg_inst || !g) return;
hgcl = margo_get_class(ssg_inst->mid);
if (!hgcl) return;
if (update.type == SSG_MEMBER_REMOVE)
{
HG_Addr_free(hgcl, g->view.member_states[update.member].addr);
free(g->view.member_states[update.member].addr_str);
g->view.member_states[update.member].addr_str = NULL;
g->view.member_states[update.member].is_member = 0;
/* XXX: need to update size ... g->view.size--; */
}
else
{
......@@ -842,7 +851,7 @@ static int ssg_group_view_create(
{
view->member_states[i].addr_str = NULL;
view->member_states[i].addr = HG_ADDR_NULL;
view->member_states[i].is_member = 1;
view->member_states[i].is_member = 0;
lookup_ults[i] = ABT_THREAD_NULL;
}
......@@ -870,6 +879,8 @@ static int ssg_group_view_create(
*/
j = (r + i) % view->size;
if (group_addr_strs[j] == NULL || strlen(group_addr_strs[j]) == 0) continue;
view->member_states[j].addr_str = strdup(group_addr_strs[j]);
if (!view->member_states[j].addr_str)
{
......@@ -926,6 +937,7 @@ static int ssg_group_view_create(
sret = SSG_FAILURE;
break;
}
view->member_states[i].is_member = 1;
}
fini:
......
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