diff --git a/include/maestro/pool.h b/include/maestro/pool.h index 359ce2b60a5cd12c45d12e912dd3c44026214994..8f8532603950fec2dd0cc0d946cd23794cfe3d2f 100644 --- a/include/maestro/pool.h +++ b/include/maestro/pool.h @@ -376,6 +376,7 @@ struct mstro_pool_event_ { /* JOIN */ struct { char *component_name; /**< component that is trying to join */ + mstro_app_id appid; /**< the app ID assigned (MSTRO_APP_ID_INVALID if JOIN:pre is observed) */ } join; /* WELCOME */ diff --git a/maestro/pool_manager.c b/maestro/pool_manager.c index 8897816642b7f07ec9a43a585734a7447b0acc2c..d7bf703076e1912c61e3345d91957cccdc3327bb 100644 --- a/maestro/pool_manager.c +++ b/maestro/pool_manager.c @@ -2020,7 +2020,9 @@ mstro_pm__handle_join_phase2(mstro_event event, /* it's safe to refer to the Appid object since the Event object is * on stack and will only be alive until notify-and-continue is * done */ - ev.origin_id = cont->msg->token->appid; + Mstro__Pool__Appid aid = MSTRO__POOL__APPID__INIT; + aid.id = regentry->appid; + ev.origin_id = &aid; status = mstro_pm__event_notify_and_continue( diff --git a/maestro/subscription_registry.c b/maestro/subscription_registry.c index 4fb434a6a90bc99a26147ede3285a27a3c5148a0..9e9b731471cd691a5833153c3325b6044d03b940 100644 --- a/maestro/subscription_registry.c +++ b/maestro/subscription_registry.c @@ -1848,7 +1848,14 @@ mstro_pool_event_consume(const Mstro__Pool__Event *eventmsg) free(ev); return MSTRO_NOMEM; } - DEBUG("Event: %s JOINed\n", ev->join.component_name); + if(eventmsg->origin_id) + ev->join.appid = eventmsg->origin_id->id; /* may be MSTRO_APP_ID_INVALID for JOIN:pre */ + else + ev->join.appid = MSTRO_APP_ID_INVALID; + + + DEBUG("Event: %s JOINed (appid %" PRIappid ")\n", + ev->join.component_name, ev->join.appid); break; case MSTRO_POOL_EVENT_APP_LEAVE: @@ -1972,6 +1979,12 @@ mstro_pool_event_consume(const Mstro__Pool__Event *eventmsg) } break; + case MSTRO_POOL_EVENT_APP_BYE: + assert(eventmsg->payload_case==MSTRO__POOL__EVENT__PAYLOAD_BYE); + ev->bye.appid = eventmsg->origin_id->id; + DEBUG("Event: %" PRIu64 " granted BYE\n", ev->bye.appid); + break; + case MSTRO_POOL_EVENT_SEAL_GROUP: case MSTRO_POOL_EVENT_DEMAND: case MSTRO_POOL_EVENT_RETRACT: @@ -1981,8 +1994,6 @@ mstro_pool_event_consume(const Mstro__Pool__Event *eventmsg) case MSTRO_POOL_EVENT_TRANSPORT_COMPLETED: /* pool-related */ - case MSTRO_POOL_EVENT_APP_WELCOME: - case MSTRO_POOL_EVENT_APP_BYE: case MSTRO_POOL_EVENT_POOL_CHECKPOINT: case MSTRO_POOL_EVENT_SUBSCRIBE: case MSTRO_POOL_EVENT_UNSUBSCRIBE: