summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2011-03-23 12:04:14 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2011-03-23 12:04:14 +0100
commit94ccd7a198cdf1de91fc2080382509654e4fe605 (patch)
tree58b99abbb88d76f1281b24281d1925f3e673cb4a
parent2db3ea3da83af8f5191c84f0ad704d8e4d97a4d8 (diff)
downloadconnman-94ccd7a198cdf1de91fc2080382509654e4fe605.tar.gz
connman-94ccd7a198cdf1de91fc2080382509654e4fe605.tar.bz2
connman-94ccd7a198cdf1de91fc2080382509654e4fe605.zip
service: Send D-Bus reply for Manager.ConnectService when service is ready
The D-Bus reply for Manager.ConnectService is currently immediatly returning the service path. It should still return it, but only after the service is ready or failed to connect. Fixes BMC#14798 Fixes BMC#14808
-rw-r--r--src/service.c20
-rwxr-xr-xtest/connect-service3
2 files changed, 17 insertions, 6 deletions
diff --git a/src/service.c b/src/service.c
index 8758b923..f4b15f0b 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2537,9 +2537,21 @@ static void reply_pending(struct connman_service *service, int error)
error);
if (reply != NULL)
g_dbus_send_message(connection, reply);
- } else
- g_dbus_send_reply(connection, service->pending,
+ } else {
+ const char *sender;
+
+ sender = dbus_message_get_interface(service->pending);
+
+ DBG("sender %s", sender);
+
+ if (g_strcmp0(sender, CONNMAN_MANAGER_INTERFACE) == 0)
+ g_dbus_send_reply(connection, service->pending,
+ DBUS_TYPE_OBJECT_PATH, &service->path,
DBUS_TYPE_INVALID);
+ else
+ g_dbus_send_reply(connection, service->pending,
+ DBUS_TYPE_INVALID);
+ }
dbus_message_unref(service->pending);
service->pending = NULL;
@@ -4128,9 +4140,7 @@ done:
if (err < 0 && err != -EINPROGRESS)
goto failed;
- g_dbus_send_reply(connection, msg,
- DBUS_TYPE_OBJECT_PATH, &service->path,
- DBUS_TYPE_INVALID);
+ service->pending = dbus_message_ref(msg);
return 0;
diff --git a/test/connect-service b/test/connect-service
index 2d88cb59..86216020 100755
--- a/test/connect-service
+++ b/test/connect-service
@@ -27,5 +27,6 @@ else:
path = manager.ConnectService(({ "Type": "wifi", "Mode": "managed",
"SSID": sys.argv[1],
"Security": security,
- "Passphrase": passphrase }));
+ "Passphrase": passphrase }),
+ timeout=60000);
print "Service path is %s" %(path)