manager: Allow async CreateSession method call
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Wed, 31 Oct 2012 09:33:27 +0000 (10:33 +0100)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 5 Nov 2012 12:40:03 +0000 (14:40 +0200)
The CreateSession D-Bus call should be marked as async call in order
to allow the session core to defer the response.

src/manager.c

index 205359a..d4f8c3d 100644 (file)
@@ -338,8 +338,12 @@ static DBusMessage *create_session(DBusConnection *conn,
        DBG("conn %p", conn);
 
        err = __connman_session_create(msg);
-       if (err < 0)
+       if (err < 0) {
+               if (err == -EINPROGRESS)
+                       return NULL;
+
                return __connman_error_failed(msg, -err);
+       }
 
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }
@@ -426,7 +430,7 @@ static const GDBusMethodTable manager_methods[] = {
        { GDBUS_METHOD("UnregisterCounter",
                        GDBUS_ARGS({ "path", "o" }), NULL,
                        unregister_counter) },
-       { GDBUS_METHOD("CreateSession",
+       { GDBUS_ASYNC_METHOD("CreateSession",
                        GDBUS_ARGS({ "settings", "a{sv}" },
                                                { "notifier", "o" }),
                        GDBUS_ARGS({ "session", "o" }),