[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-test7-33-gdaa945a

Lennart Poettering gitmailer-noreply at 0pointer.de
Sun Apr 5 19:21:36 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  ecba42bd302ee5737adc462437abc42160827e8c (commit)

- Log -----------------------------------------------------------------
daa945a don't fail device reservation if the D-Bus connection is dead
4b521e5 be a bit more verbose about the busses we are connected to
90f4fdb make sure we keep a reference of the bus connection during the whole runtime if we manage to acquire the bus name
-----------------------------------------------------------------------

Summary of changes:
 src/daemon/main.c          |   36 +++++++++++++++++++++++++++---------
 src/modules/reserve-wrap.c |   11 +++++++++--
 src/pulsecore/dbus-util.c  |   12 ++++++++++--
 3 files changed, 46 insertions(+), 13 deletions(-)

-----------------------------------------------------------------------

commit 90f4fdb0718f4cdef717c555fe2ed81ff59f6fce
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Apr 6 02:31:22 2009 +0200

    make sure we keep a reference of the bus connection during the whole runtime if we manage to acquire the bus name

diff --git a/src/daemon/main.c b/src/daemon/main.c
index d25647c..4c4a905 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -334,27 +334,38 @@ static void set_all_rlimits(const pa_daemon_conf *conf) {
 #endif
 
 #ifdef HAVE_DBUS
-static void register_org_pulseaudio(pa_core *c)
-{
+static pa_dbus_connection *register_dbus(pa_core *c) {
     DBusError error;
     pa_dbus_connection *conn;
 
     dbus_error_init(&error);
+
     if (!(conn = pa_dbus_bus_get(c, pa_in_system_mode() ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, &error)) || dbus_error_is_set(&error)) {
-        pa_log_warn("Unable to contact DBUS: %s: %s", error.name, error.message);
-        goto finish_dbus;
+        pa_log_warn("Unable to contact D-Bus: %s: %s", error.name, error.message);
+        goto fail;
     }
 
-    if (dbus_bus_request_name (pa_dbus_connection_get(conn), "org.pulseaudio.Server", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+    if (dbus_bus_request_name(pa_dbus_connection_get(conn), "org.pulseaudio.Server", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
         pa_log_debug("Got org.pulseaudio.Server!");
-    else if (dbus_error_is_set(&error))
-        pa_log_warn("Unable to get org.pulseaudio.Server: %s: %s", error.name, error.message);
+        return conn;
+    }
+
+    if (dbus_error_is_set(&error))
+        pa_log_warn("Failed to acquire org.pulseaudio.Server: %s: %s", error.name, error.message);
+    else
+        pa_log_warn("D-Bus name org.pulseaudio.Server already taken. Weird shit!");
+
+    /* PA cannot be started twice by the same user and hence we can
+     * ignore mostly the case that org.pulseaudio.Server is already
+     * taken. */
+
+fail:
 
-finish_dbus:
     if (conn)
         pa_dbus_connection_unref(conn);
 
     dbus_error_free(&error);
+    return NULL;
 }
 #endif
 
@@ -380,6 +391,9 @@ int main(int argc, char *argv[]) {
 #endif
     int autospawn_fd = -1;
     pa_bool_t autospawn_locked = FALSE;
+#ifdef HAVE_DBUS
+    pa_dbus_connection *dbus = NULL;
+#endif
 
     pa_log_set_ident("pulseaudio");
     pa_log_set_level(PA_LOG_INFO);
@@ -1026,7 +1040,7 @@ int main(int argc, char *argv[]) {
 #endif
 
 #ifdef HAVE_DBUS
-    register_org_pulseaudio(c);
+    dbus = register_dbus(c);
 #endif
 
     pa_log_info(_("Daemon startup complete."));
@@ -1038,6 +1052,10 @@ int main(int argc, char *argv[]) {
     pa_log_info(_("Daemon shutdown initiated."));
 
 finish:
+#ifdef HAVE_DBUS
+    if (dbus)
+        pa_dbus_connection_unref(dbus);
+#endif
 
     if (autospawn_fd >= 0) {
         if (autospawn_locked)
diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c
index d712bff..7302867 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -244,7 +244,7 @@ static void wakeup_main(void *userdata) {
 
 pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *m, DBusBusType type, DBusError *error) {
     DBusConnection *conn;
-    pa_dbus_wrap_connection *pconn = NULL;
+    pa_dbus_wrap_connection *pconn;
 
     pa_assert(type == DBUS_BUS_SYSTEM || type == DBUS_BUS_SESSION || type == DBUS_BUS_STARTER);
 
@@ -273,7 +273,8 @@ void pa_dbus_wrap_connection_free(pa_dbus_wrap_connection* c) {
         dbus_connection_close(c->connection);
         /* must process remaining messages, bit of a kludge to handle
          * both unload and shutdown */
-        while (dbus_connection_read_write_dispatch(c->connection, -1));
+        while (dbus_connection_read_write_dispatch(c->connection, -1))
+            ;
     }
 
     c->mainloop->defer_free(c->dispatch_event);

commit 4b521e5d24ef965345fcfe7ea1c63fbb4b687174
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Apr 6 04:20:12 2009 +0200

    be a bit more verbose about the busses we are connected to

diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c
index 7302867..b35e747 100644
--- a/src/pulsecore/dbus-util.c
+++ b/src/pulsecore/dbus-util.c
@@ -28,6 +28,8 @@
 
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
+
+#include <pulsecore/core-util.h>
 #include <pulsecore/log.h>
 
 #include "dbus-util.h"
@@ -263,6 +265,11 @@ pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *m, DBusBus
 
     pconn->dispatch_event = pconn->mainloop->defer_new(pconn->mainloop, dispatch_cb, conn);
 
+    pa_log_debug("Successfully connected to D-Bus %s bus %s as %s",
+                 type == DBUS_BUS_SYSTEM ? "system" : (type == DBUS_BUS_SESSION ? "session" : "starter"),
+                 pa_strnull(dbus_connection_get_server_id(conn)),
+                 pa_strnull(dbus_bus_get_unique_name(conn)));
+
     return pconn;
 }
 

commit daa945aa324af5b71332a3cd07890d1cf3a1cb60
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Apr 6 04:21:26 2009 +0200

    don't fail device reservation if the D-Bus connection is dead

diff --git a/src/modules/reserve-wrap.c b/src/modules/reserve-wrap.c
index 1927342..02ff29b 100644
--- a/src/modules/reserve-wrap.c
+++ b/src/modules/reserve-wrap.c
@@ -23,6 +23,8 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
+
 #include <pulse/xmalloc.h>
 #include <pulse/i18n.h>
 
@@ -127,8 +129,13 @@ pa_reserve_wrapper* pa_reserve_wrapper_get(pa_core *c, const char *device_name)
                  request_cb,
                  NULL)) < 0) {
 
-        pa_log_error("Failed to acquire reservation lock on device '%s': %s", device_name, pa_cstrerror(-k));
-        goto fail;
+        if (k == -EBUSY) {
+            pa_log_error("Device '%s' already locked.", device_name);
+            goto fail;
+        } else {
+            pa_log_warn("Failed to acquire reservation lock on device '%s': %s", device_name, pa_cstrerror(-k));
+            return r;
+        }
     }
 
     pa_log_debug("Successfully acquired reservation lock on device '%s'", device_name);

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list