From: Anders Carlsson Date: Thu, 13 Feb 2003 21:37:58 +0000 (+0000) Subject: 2003-02-13 Anders Carlsson X-Git-Tag: dbus-0.4~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97ee8d189948c9f2c86464ca33f82e6daeaedc72;p=platform%2Fupstream%2Fdbus.git 2003-02-13 Anders Carlsson * bus/driver.c: (bus_driver_handle_hello): * bus/driver.h: * bus/services.c: (bus_service_lookup): Reorder message sending so we get a more sane order. * test/bus-test.c: (message_handler): Fix tyop. --- diff --git a/ChangeLog b/ChangeLog index a253404..7f2cb75 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2003-02-13 Anders Carlsson + * bus/driver.c: (bus_driver_handle_hello): + * bus/driver.h: + * bus/services.c: (bus_service_lookup): + Reorder message sending so we get a more sane order. + + * test/bus-test.c: (message_handler): + Fix tyop. + +2003-02-13 Anders Carlsson + * bus/driver.c: (bus_driver_send_service_deleted), (bus_driver_send_service_created), (bus_driver_send_service_lost), (bus_driver_send_service_acquired), (bus_driver_handle_hello), diff --git a/bus/driver.c b/bus/driver.c index 25d6d26..9983f57 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -52,7 +52,7 @@ bus_driver_send_service_deleted (const char *service_name) dbus_message_unref (message); } -static void +void bus_driver_send_service_created (const char *service_name) { DBusMessage *message; @@ -172,24 +172,21 @@ bus_driver_handle_hello (DBusConnection *connection, BUS_HANDLE_OOM (_dbus_string_init (&unique_name, _DBUS_INT_MAX)); BUS_HANDLE_OOM (create_unique_client_name (&unique_name)); + + BUS_HANDLE_OOM (bus_connection_set_name (connection, &unique_name)); + BUS_HANDLE_OOM (dbus_message_set_sender (message, + bus_connection_get_name (connection))); + BUS_HANDLE_OOM (bus_driver_send_welcome_message (connection, message)); + /* Create the service */ BUS_HANDLE_OOM (service = bus_service_lookup (&unique_name, TRUE)); bus_service_set_prohibit_replacement (service, TRUE); /* Add the connection as the owner */ BUS_HANDLE_OOM (bus_service_add_owner (service, connection)); - BUS_HANDLE_OOM (bus_connection_set_name (connection, &unique_name)); - BUS_HANDLE_OOM (dbus_message_set_sender (message, - bus_connection_get_name (connection))); - _dbus_string_free (&unique_name); - - BUS_HANDLE_OOM (bus_driver_send_welcome_message (connection, message)); - - /* Broadcast a service created message */ - bus_driver_send_service_created (bus_service_get_name (service)); } static void diff --git a/bus/driver.h b/bus/driver.h index fc4d259..3019fe4 100644 --- a/bus/driver.h +++ b/bus/driver.h @@ -34,6 +34,7 @@ void bus_driver_send_service_lost (DBusConnection *connection, const char *service_name); void bus_driver_send_service_acquired (DBusConnection *connection, const char *service_name); +void bus_driver_send_service_created (const char *service_name); diff --git a/bus/services.c b/bus/services.c index 1c94955..497978d 100644 --- a/bus/services.c +++ b/bus/services.c @@ -99,6 +99,8 @@ bus_service_lookup (const DBusString *service_name, return NULL; } + bus_driver_send_service_created (service->name); + return service; } diff --git a/glib/test-dbus-glib.c b/glib/test-dbus-glib.c index ad147e5..085e856 100644 --- a/glib/test-dbus-glib.c +++ b/glib/test-dbus-glib.c @@ -23,9 +23,6 @@ main (int argc, char **argv) dbus_connection_hookup_with_g_main (connection); message = dbus_message_new ("org.freedesktop.DBus", "org.freedesktop.DBus.Hello"); - dbus_message_append_fields (message, - DBUS_TYPE_STRING, "glib-test", - 0); reply = dbus_connection_send_message_with_reply_and_block (connection, message, -1, &result); g_print ("reply name: %s\n", dbus_message_get_name (reply)); diff --git a/test/bus-test.c b/test/bus-test.c index cfafe0f..624c11e 100644 --- a/test/bus-test.c +++ b/test/bus-test.c @@ -62,7 +62,7 @@ message_handler (DBusMessageHandler *handler, DBusMessage *message, void *user_data) { - printf ("server got a message!: %s\n", + printf ("client got a message!: %s\n", dbus_message_get_name (message)); return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; }