X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bus%2Fdispatch.c;h=a7d4c3743e60b1b38767ad83ac81f1611a2932a8;hb=61d97215c317a4154df47fbfb882aab60b92fbab;hp=dfe6f746dc4670c41fbbbe30876c4f3c9a128e2a;hpb=d6ad37c3044ed6c72bf652c6e505c6ad9aa9e889;p=platform%2Fupstream%2Fdbus.git diff --git a/bus/dispatch.c b/bus/dispatch.c index dfe6f74..a7d4c37 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -4,6 +4,7 @@ * Copyright (C) 2003 CodeFactory AB * Copyright (C) 2003, 2004, 2005 Red Hat, Inc. * Copyright (C) 2004 Imendio HB + * Copyright (C) 2013 Samsung Electronics * * Licensed under the Academic Free License version 2.1 * @@ -34,24 +35,21 @@ #include "signals.h" #include "test.h" #include +#include #include +#ifdef ENABLE_KDBUS_TRANSPORT +#include "kdbus-d.h" +#endif #ifdef HAVE_UNIX_FD_PASSING #include #include #endif -#ifndef TEST_CONNECTION -/* - TODO autotools: - move to build system as already done for cmake -*/ -#ifdef DBUS_UNIX -#define TEST_CONNECTION "debug-pipe:name=test-server" -#else -#define TEST_CONNECTION "tcp:host=localhost,port=1234" -#endif -#endif +/* This is hard-coded in the files in valid-config-files-*. We have to use + * the debug-pipe transport because the tests in this file require that + * dbus_connection_open_private() does not block. */ +#define TEST_DEBUG_PIPE "debug-pipe:name=test-server" static dbus_bool_t send_one_message (DBusConnection *connection, @@ -224,6 +222,14 @@ bus_dispatch (DBusConnection *connection, } #endif /* DBUS_ENABLE_VERBOSE_MODE */ + /* Create our transaction */ + transaction = bus_transaction_new (context); + if (transaction == NULL) + { + BUS_SET_OOM (&error); + goto out; + } + /* If service_name is NULL, if it's a signal we send it to all * connections with a match rule. If it's not a signal, there * are some special cases here but mostly we just bail out. @@ -246,18 +252,25 @@ bus_dispatch (DBusConnection *connection, result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; goto out; } - } - /* Create our transaction */ - transaction = bus_transaction_new (context); - if (transaction == NULL) - { - BUS_SET_OOM (&error); - goto out; +#ifdef ENABLE_KDBUS_TRANSPORT + if(bus_context_is_kdbus(context)) + { + if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) + { + handleNameOwnerChanged(message, transaction, connection); + goto out; + } + } +#endif } +#ifdef ENABLE_KDBUS_TRANSPORT /* Assign a sender to the message */ - if (bus_connection_is_active (connection)) + if(bus_context_is_kdbus(context) == FALSE) //if using kdbus, sender must be set on library side +#endif + { + if (bus_connection_is_active (connection)) { sender = bus_connection_get_name (connection); _dbus_assert (sender != NULL); @@ -275,6 +288,7 @@ bus_dispatch (DBusConnection *connection, */ service_name = dbus_message_get_destination (message); } + } if (service_name && strcmp (service_name, DBUS_SERVICE_DBUS) == 0) /* to bus driver */ @@ -309,7 +323,11 @@ bus_dispatch (DBusConnection *connection, _dbus_string_init_const (&service_string, service_name); service = bus_registry_lookup (registry, &service_string); +#ifdef ENABLE_KDBUS_TRANSPORT + if (dbus_message_get_auto_start (message) && (service == NULL || bus_service_get_is_kdbus_starter(service))) +#else if (service == NULL && dbus_message_get_auto_start (message)) +#endif { BusActivation *activation; /* We can't do the security policy check here, since the addressed @@ -435,7 +453,7 @@ bus_dispatch_remove_connection (DBusConnection *connection) NULL); } -#ifdef DBUS_BUILD_TESTS +#ifdef DBUS_ENABLE_EMBEDDED_TESTS #include @@ -1532,7 +1550,7 @@ check_hello_connection (BusContext *context) dbus_error_init (&error); - connection = dbus_connection_open_private (TEST_CONNECTION, &error); + connection = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (connection == NULL) { _DBUS_ASSERT_ERROR_IS_SET (&error); @@ -4473,7 +4491,7 @@ setenv_TEST_LAUNCH_HELPER_CONFIG(const DBusString *test_data_dir, _dbus_verbose ("Setting TEST_LAUNCH_HELPER_CONFIG to '%s'\n", _dbus_string_get_const_data (&full)); - _dbus_setenv ("TEST_LAUNCH_HELPER_CONFIG", _dbus_string_get_const_data (&full)); + dbus_setenv ("TEST_LAUNCH_HELPER_CONFIG", _dbus_string_get_const_data (&full)); _dbus_string_free (&full); @@ -4501,7 +4519,7 @@ bus_dispatch_test_conf (const DBusString *test_data_dir, if (context == NULL) return FALSE; - foo = dbus_connection_open_private (TEST_CONNECTION, &error); + foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (foo == NULL) _dbus_assert_not_reached ("could not alloc connection"); @@ -4519,7 +4537,7 @@ bus_dispatch_test_conf (const DBusString *test_data_dir, if (!check_add_match_all (context, foo)) _dbus_assert_not_reached ("AddMatch message failed"); - bar = dbus_connection_open_private (TEST_CONNECTION, &error); + bar = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (bar == NULL) _dbus_assert_not_reached ("could not alloc connection"); @@ -4534,7 +4552,7 @@ bus_dispatch_test_conf (const DBusString *test_data_dir, if (!check_add_match_all (context, bar)) _dbus_assert_not_reached ("AddMatch message failed"); - baz = dbus_connection_open_private (TEST_CONNECTION, &error); + baz = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (baz == NULL) _dbus_assert_not_reached ("could not alloc connection"); @@ -4650,7 +4668,7 @@ bus_dispatch_test_conf_fail (const DBusString *test_data_dir, if (context == NULL) return FALSE; - foo = dbus_connection_open_private (TEST_CONNECTION, &error); + foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (foo == NULL) _dbus_assert_not_reached ("could not alloc connection"); @@ -4733,7 +4751,7 @@ bus_dispatch_sha1_test (const DBusString *test_data_dir) if (context == NULL) return FALSE; - foo = dbus_connection_open_private (TEST_CONNECTION, &error); + foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (foo == NULL) _dbus_assert_not_reached ("could not alloc connection"); @@ -4782,7 +4800,7 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir) if (context == NULL) _dbus_assert_not_reached ("could not alloc context"); - foo = dbus_connection_open_private (TEST_CONNECTION, &error); + foo = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (foo == NULL) _dbus_assert_not_reached ("could not alloc connection"); @@ -4797,7 +4815,7 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir) if (!check_add_match_all (context, foo)) _dbus_assert_not_reached ("AddMatch message failed"); - bar = dbus_connection_open_private (TEST_CONNECTION, &error); + bar = dbus_connection_open_private (TEST_DEBUG_PIPE, &error); if (bar == NULL) _dbus_assert_not_reached ("could not alloc connection"); @@ -4914,4 +4932,4 @@ bus_unix_fds_passing_test(const DBusString *test_data_dir) } #endif -#endif /* DBUS_BUILD_TESTS */ +#endif /* DBUS_ENABLE_EMBEDDED_TESTS */