diff --git a/jack/session.h b/jack/session.h index 8c13bfa..50ea17b 100644 --- a/jack/session.h +++ b/jack/session.h @@ -63,14 +63,6 @@ enum JackSessionFlags { * an error occured while saving. */ JackSessionSaveError = 0x01, - - /** - * this reply indicates that a client is part of a multiclient application. - * the command reply is left empty. but the session manager should still - * consider this client part of a session. it will come up due to invocation of another - * client. - */ - JackSessionChildClient = 0x02 }; typedef enum JackSessionFlags jack_session_flags_t; @@ -130,6 +122,10 @@ typedef void (*JackSessionCallback)(jack_session_event_t *event, void *arg); * Tell the JACK server to call @a save_callback the session handler wants * to save. * + * setting more than one session_callback per process is probably a design + * error. if you have a multiclient application its more sensible to create + * a jack_client with only a session callback set. + * * @return 0 on success, otherwise a non-zero error code */ int jack_set_session_callback(jack_client_t *client, @@ -155,7 +151,16 @@ int jack_session_reply( jack_client_t *client, jack_session_event_t *event ) JAC * if its non NULL. */ -void jack_session_event_free (jack_session_event_t *event); +void jack_session_event_free (jack_session_event_t *event) JACK_WEAK_EXPORT; + + +/** + * get the assigned uuid for client. + * safe to call from callback and all other threads. + * memory needs to be freed. + */ + +char *jack_client_get_uuid (jack_client_t *client) JACK_WEAK_EXPORT; /*@}*/ diff --git a/jackd/engine.c b/jackd/engine.c index e3fa1d8..f8ace40 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -2638,14 +2638,18 @@ jack_do_session_notify (jack_engine_t *engine, jack_request_t *req, int reply_fd /* GRAPH MUST BE LOCKED : see callers of jack_send_connection_notification() */ + // make sure all uuids are set. + for (node = engine->clients; node; node = jack_slist_next (node)) { + jack_client_internal_t* client = (jack_client_internal_t*) node->data; + if( client->control->uid == 0 ) { + client->control->uid=jack_engine_get_max_uuid( engine ) + 1; + } + } + for (node = engine->clients; node; node = jack_slist_next (node)) { jack_client_internal_t* client = (jack_client_internal_t*) node->data; if (client->control->session_cbset) { - if( client->control->uid == 0 ) { - client->control->uid=jack_engine_get_max_uuid( engine ) + 1; - } - // in case we only want to send to a special client. // uuid assign is still complete. not sure if thats necessary. if( (req->x.session.target[0] != 0) && strcmp(req->x.session.target, (char *)client->control->name) ) diff --git a/libjack/client.c b/libjack/client.c index 793a3c8..c82726a 100644 --- a/libjack/client.c +++ b/libjack/client.c @@ -2676,6 +2676,16 @@ jack_get_client_name_by_uuid( jack_client_t *client, const char *uuid ) return strdup( request.x.port_info.name ); } +char * +jack_client_get_uuid( jack_client_t *client ) +{ + char retval[16]; + + snprintf( retval, sizeof(retval), "%d", client->control->uid ); + + return strdup(retval); +} + int jack_reserve_client_name( jack_client_t *client, const char *name, const char *uuid ) {