From 0a69fba0814b8ad89b4de71ef1608ebd0ccea16f Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Mon, 28 Dec 2020 16:44:25 +0900 Subject: [PATCH] protocol-native, client: dump current connections on every new incoming connection [Version] 13.0-35 [Issue Type] Debugging Change-Id: I4078d1f7c8da1d4afbe4f472298aaf7f184c62e6 --- packaging/pulseaudio.spec | 2 +- src/pulsecore/client.c | 13 +++++++++++++ src/pulsecore/client.h | 3 +++ src/pulsecore/protocol-native.c | 18 ++++++++++++++++++ src/pulsecore/protocol-native.h | 4 ++++ 5 files changed, 39 insertions(+), 1 deletion(-) diff --git a/packaging/pulseaudio.spec b/packaging/pulseaudio.spec index ffff57a..fc319a7 100644 --- a/packaging/pulseaudio.spec +++ b/packaging/pulseaudio.spec @@ -3,7 +3,7 @@ Name: pulseaudio Summary: Improved Linux sound server Version: 13.0 -Release: 34 +Release: 35 Group: Multimedia/Audio License: LGPL-2.1 URL: http://pulseaudio.org diff --git a/src/pulsecore/client.c b/src/pulsecore/client.c index 2e6af47..ae5f608 100644 --- a/src/pulsecore/client.c +++ b/src/pulsecore/client.c @@ -139,6 +139,19 @@ void pa_client_update_proplist(pa_client *c, pa_update_mode_t mode, pa_proplist pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_CHANGE, c->index); } +#ifdef __TIZEN__ +void pa_client_dump_status(pa_client *c) { + pa_assert(c); + + pa_log_info(_("\t#%u, %s, %s(%s)"), + c->index, pa_strnull(c->driver), + pa_strnull(pa_proplist_gets(c->proplist, PA_PROP_APPLICATION_PROCESS_BINARY)), + pa_strnull(pa_proplist_gets(c->proplist, PA_PROP_APPLICATION_PROCESS_ID))); + + /* ToDo : dump connection time */ +} +#endif + void pa_client_send_event(pa_client *c, const char *event, pa_proplist *data) { pa_proplist *pl = NULL; pa_client_send_event_hook_data hook_data; diff --git a/src/pulsecore/client.h b/src/pulsecore/client.h index eb8173d..ffd19bf 100644 --- a/src/pulsecore/client.h +++ b/src/pulsecore/client.h @@ -71,6 +71,9 @@ void pa_client_kill(pa_client *c); void pa_client_set_name(pa_client *c, const char *name); void pa_client_update_proplist(pa_client *c, pa_update_mode_t mode, pa_proplist *p); +#ifdef __TIZEN__ +void pa_client_dump_status(pa_client *c); +#endif void pa_client_send_event(pa_client *c, const char *event, pa_proplist *data); diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index acc74b4..7cf7b01 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -5392,6 +5392,20 @@ static void auth_timeout(pa_mainloop_api*m, pa_time_event *e, const struct timev } } +#ifdef __TIZEN__ +void pa_native_protocol_dump_connections(pa_native_protocol *p) { + pa_native_connection *c = NULL; + void *state = NULL; + + pa_assert(p); + + pa_log_info("Dump status of current connections(%u)", pa_idxset_size(p->connections)); + + while ((c = pa_idxset_iterate(p->connections, &state, NULL))) + pa_client_dump_status(c->client); +} +#endif + void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_native_options *o) { pa_native_connection *c; char pname[128]; @@ -5402,6 +5416,10 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati pa_assert(io); pa_assert(o); +#ifdef __TIZEN__ + pa_native_protocol_dump_connections(p); +#endif + if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) { pa_log_warn("Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); diff --git a/src/pulsecore/protocol-native.h b/src/pulsecore/protocol-native.h index 0347fdf..30cf623 100644 --- a/src/pulsecore/protocol-native.h +++ b/src/pulsecore/protocol-native.h @@ -85,4 +85,8 @@ pa_native_options* pa_native_options_ref(pa_native_options *o); void pa_native_options_unref(pa_native_options *o); int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma); +#ifdef __TIZEN__ +void pa_native_protocol_dump_connections(pa_native_protocol *p); +#endif + #endif -- 2.7.4