summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-manager.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-11-13 17:23:32 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-11-13 17:23:32 +0000
commitcc20b5c9b26dec7a97c922caa28f6ebf454f9c54 (patch)
tree358f010c170e65051f5e4d2651b454fa428385da /hcid/dbus-manager.c
parent08d4b899b52f5e43f60950b6c87095952738269c (diff)
Send reply before doing autostart
Diffstat (limited to 'hcid/dbus-manager.c')
-rw-r--r--hcid/dbus-manager.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/hcid/dbus-manager.c b/hcid/dbus-manager.c
index e538a738..55c601ae 100644
--- a/hcid/dbus-manager.c
+++ b/hcid/dbus-manager.c
@@ -260,6 +260,7 @@ static DBusHandlerResult register_service(DBusConnection *conn,
DBusMessage *msg, void *data)
{
const char *path, *name, *description;
+ DBusHandlerResult result;
DBusMessage *message;
DBusError err;
int reg_err;
@@ -290,10 +291,16 @@ static DBusHandlerResult register_service(DBusConnection *conn,
/* Report that a new service was registered */
message = dbus_message_new_signal(BASE_PATH, MANAGER_INTERFACE,
"ServiceRegistered");
+
dbus_message_append_args(message, DBUS_TYPE_STRING, &path,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_INVALID);
+
send_message_and_unref(conn, message);
+ result = send_message_and_unref(conn, dbus_message_new_method_return(msg));
+
+ dbus_connection_flush(conn);
+
/* If autostart feature is enabled: send the Start message to the service agent */
if (autostart) {
DBusPendingCall *pending;
@@ -307,20 +314,22 @@ static DBusHandlerResult register_service(DBusConnection *conn,
if (dbus_connection_send_with_reply(conn, message, &pending, START_REPLY_TIMEOUT) == FALSE) {
dbus_message_unref(message);
- goto fail;
+ return result;
}
+ dbus_connection_flush(conn);
+
dbus_connection_get_object_path_data(conn, path, (void *) &agent);
call = service_call_new(conn, message, agent);
dbus_message_unref(message);
if (!call)
- goto fail;
+ return result;
dbus_pending_call_set_notify(pending, autostart_reply, call, service_call_free);
}
-fail:
- return send_message_and_unref(conn, dbus_message_new_method_return(msg));
+
+ return result;
}
static DBusHandlerResult unregister_service(DBusConnection *conn,