Commit 97ee8d18 authored by Anders Carlsson's avatar Anders Carlsson

2003-02-13 Anders Carlsson <andersca@codefactory.se>

	* 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.
parent aa4b4ef5
2003-02-13 Anders Carlsson <andersca@codefactory.se>
* 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 <andersca@codefactory.se> 2003-02-13 Anders Carlsson <andersca@codefactory.se>
* bus/driver.c: (bus_driver_send_service_deleted), * bus/driver.c: (bus_driver_send_service_deleted),
......
...@@ -52,7 +52,7 @@ bus_driver_send_service_deleted (const char *service_name) ...@@ -52,7 +52,7 @@ bus_driver_send_service_deleted (const char *service_name)
dbus_message_unref (message); dbus_message_unref (message);
} }
static void void
bus_driver_send_service_created (const char *service_name) bus_driver_send_service_created (const char *service_name)
{ {
DBusMessage *message; DBusMessage *message;
...@@ -172,24 +172,21 @@ bus_driver_handle_hello (DBusConnection *connection, ...@@ -172,24 +172,21 @@ bus_driver_handle_hello (DBusConnection *connection,
BUS_HANDLE_OOM (_dbus_string_init (&unique_name, _DBUS_INT_MAX)); BUS_HANDLE_OOM (_dbus_string_init (&unique_name, _DBUS_INT_MAX));
BUS_HANDLE_OOM (create_unique_client_name (&unique_name)); 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 */ /* Create the service */
BUS_HANDLE_OOM (service = bus_service_lookup (&unique_name, TRUE)); BUS_HANDLE_OOM (service = bus_service_lookup (&unique_name, TRUE));
bus_service_set_prohibit_replacement (service, TRUE); bus_service_set_prohibit_replacement (service, TRUE);
/* Add the connection as the owner */ /* Add the connection as the owner */
BUS_HANDLE_OOM (bus_service_add_owner (service, connection)); 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); _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 static void
......
...@@ -34,6 +34,7 @@ void bus_driver_send_service_lost (DBusConnection *connection, ...@@ -34,6 +34,7 @@ void bus_driver_send_service_lost (DBusConnection *connection,
const char *service_name); const char *service_name);
void bus_driver_send_service_acquired (DBusConnection *connection, void bus_driver_send_service_acquired (DBusConnection *connection,
const char *service_name); const char *service_name);
void bus_driver_send_service_created (const char *service_name);
......
...@@ -99,6 +99,8 @@ bus_service_lookup (const DBusString *service_name, ...@@ -99,6 +99,8 @@ bus_service_lookup (const DBusString *service_name,
return NULL; return NULL;
} }
bus_driver_send_service_created (service->name);
return service; return service;
} }
......
...@@ -23,9 +23,6 @@ main (int argc, char **argv) ...@@ -23,9 +23,6 @@ main (int argc, char **argv)
dbus_connection_hookup_with_g_main (connection); dbus_connection_hookup_with_g_main (connection);
message = dbus_message_new ("org.freedesktop.DBus", "org.freedesktop.DBus.Hello"); 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); reply = dbus_connection_send_message_with_reply_and_block (connection, message, -1, &result);
g_print ("reply name: %s\n", dbus_message_get_name (reply)); g_print ("reply name: %s\n", dbus_message_get_name (reply));
......
...@@ -62,7 +62,7 @@ message_handler (DBusMessageHandler *handler, ...@@ -62,7 +62,7 @@ message_handler (DBusMessageHandler *handler,
DBusMessage *message, DBusMessage *message,
void *user_data) void *user_data)
{ {
printf ("server got a message!: %s\n", printf ("client got a message!: %s\n",
dbus_message_get_name (message)); dbus_message_get_name (message));
return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS; return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment