diff --git a/tests/simple_telemetry_listener.c b/tests/simple_telemetry_listener.c index 383042fa552e55b5ff234b9ee7dedd7e613a2481..a1c627cc3a3a8c7e3a17c15d612c1e086e4842e1 100644 --- a/tests/simple_telemetry_listener.c +++ b/tests/simple_telemetry_listener.c @@ -321,34 +321,13 @@ store_telemetry(mstro_pool_event e) mstro_status event_loop(void) { - /* wildcard selector: any CDO */ - mstro_cdo_selector selector=NULL; - mstro_status s=mstro_cdo_selector_create( - NULL, NULL, - "(has .maestro.core.cdo.name)", - &selector); - - - /* Subscribe to DECLARE and SEAL. - * - * That allows us to log app-id/name/local-id and later - * app-id/local-id/cdo-id - */ - mstro_subscription cdo_subscription=NULL; - s = mstro_subscribe(selector, - MSTRO_POOL_EVENT_DECLARE |MSTRO_POOL_EVENT_SEAL, - MSTRO_SUBSCRIPTION_OPTS_DEFAULT, - &cdo_subscription); - s=mstro_cdo_selector_dispose(selector); - - /* Subscribe to JOIN and LEAVE ('after' events, after handling on the PM). * * That allows us to log component names and implement a termination * criterion like "if component X has left, terminate telemetry * listener" */ mstro_subscription join_leave_subscription=NULL; - s=mstro_subscribe( + mstro_status s=mstro_subscribe( NULL, MSTRO_POOL_EVENT_APP_JOIN|MSTRO_POOL_EVENT_APP_LEAVE, MSTRO_SUBSCRIPTION_OPTS_DEFAULT, &join_leave_subscription); @@ -364,7 +343,7 @@ event_loop(void) while(!done) { mstro_pool_event e=NULL; /* poll join/leave */ - s=mstro_subscription_poll(join_leave_subscription, &e); + s =mstro_subscription_poll(join_leave_subscription, &e); if(e!=NULL) { /* reset start time, since we saw some event */ @@ -425,41 +404,8 @@ event_loop(void) /* no need to ack these events s=mstro_subscription_ack(join_leave_subscription, e); */ /* dispose all */ s=mstro_pool_event_dispose(e); - } else { - s=mstro_subscription_poll(cdo_subscription, &e); - if(e!=NULL) { - /* reset start time, since we saw some event */ - starttime = mstro_clock(); - - mstro_pool_event tmp=e; - /* handle all */ - while(tmp) { - store_telemetry(tmp); - - switch(tmp->kind) { - case MSTRO_POOL_EVENT_DECLARE: - case MSTRO_POOL_EVENT_SEAL: - if(g_verbose) { - fprintf(stdout, "CDO event %s\n", - mstro_pool_event_description(tmp->kind)); - } - break; - default: - fprintf(stderr, "Unexpected CDO event %d\n", tmp->kind); - } - - tmp=tmp->next; - } - /* acknowledge all */ - /* no need to ack these events s=mstro_subscription_ack(cdo_subscription, e); */ - /* dispose all */ - s=mstro_pool_event_dispose(e); - } else { - sleep(1); /* core will queue up events for us, no need to do - * intensive busy-loop */ - } } - + if((0 < leaveCount) && (joinCount == leaveCount)) { done=true; } @@ -471,10 +417,8 @@ event_loop(void) } if(done) break; /* from WHILE */ - } - s= mstro_subscription_dispose(cdo_subscription); - s= mstro_subscription_dispose(join_leave_subscription); + s=mstro_subscription_dispose(join_leave_subscription); BAILOUT: return s;