Skip to content
Snippets Groups Projects
Commit dbb98fc7 authored by Utz-Uwe Haus's avatar Utz-Uwe Haus
Browse files

REQUIRE every OFFERed CDO in simple_archiver

In an attempt to reproduce #20; not reproducing it on MacOS, needs check
on other systems.
parent bdb5950c
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,45 @@
#define ERR(...) LOG_ERR(MSTRO_LOG_MODULE_USER,__VA_ARGS__)
// a list (used as stack) to store CDO handles
CHEAT_DECLARE(
struct cdo_list_entry {
mstro_cdo cdo;
struct cdo_list_entry *next;
};
struct cdo_list_entry *g_cdo_handles = NULL;
struct cdo_list_entry *
push_cdo(mstro_cdo c)
{
struct cdo_list_entry *e = malloc(sizeof(struct cdo_list_entry));
if(e!=NULL) {
e->cdo = c;
e->next = g_cdo_handles;
g_cdo_handles = e;
}
return e;
}
mstro_cdo
pop_cdo()
{
struct cdo_list_entry *e = NULL;
if(g_cdo_handles!=NULL) {
e=g_cdo_handles;
g_cdo_handles=g_cdo_handles->next;
};
if(e) {
mstro_cdo c = e->cdo;
free(e);
return c;
} else
return NULL;
}
)
CHEAT_DECLARE(
const mstro_nanosec_t MAX_WAIT = ((mstro_nanosec_t)15)*1000*1000*1000; /* 10s */
......@@ -152,6 +191,13 @@ CHEAT_TEST(simple_archiver,
case MSTRO_POOL_EVENT_OFFER:
/* FIXME: Immediately post a REQUIRE for it */
cdo_name = tmp->offer.cdo_name;
mstro_cdo c;
cheat_assert(MSTRO_OK==mstro_cdo_declare(
tmp->offer.cdo_name,
MSTRO_ATTR_DEFAULT,
&c));
cheat_assert(MSTRO_OK==mstro_cdo_require(c));
cheat_assert(NULL!=push_cdo(c));
break;
case MSTRO_POOL_EVENT_DECLARE:
......@@ -211,10 +257,21 @@ CHEAT_TEST(simple_archiver,
}
DEBUG("Left polling loop\n");
DEBUG("retracting all outstanding requires\n");
{
mstro_cdo c;
while((c=pop_cdo())!=NULL) {
cheat_assert(MSTRO_OK==mstro_cdo_retract(c));
cheat_assert(MSTRO_OK==mstro_cdo_dispose(c));
}
}
cheat_assert(MSTRO_OK
== mstro_subscription_dispose(cdo_subscription));
cheat_assert(MSTRO_OK
== mstro_subscription_dispose(join_leave_subscription));
cheat_assert(MSTRO_OK == mstro_finalize());
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment