summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2012-06-15 16:00:19 +0300
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-06-18 10:55:40 +0300
commitb8162e19cfc7b3ce25b72983c0df4de6e14cbafe (patch)
tree43f85f8581712a6c76f83988559b506050ae49c3 /src
parent53b7e1339c05b178697e611f881594ed78c02d65 (diff)
downloadconnman-b8162e19cfc7b3ce25b72983c0df4de6e14cbafe.tar.gz
connman-b8162e19cfc7b3ce25b72983c0df4de6e14cbafe.tar.bz2
connman-b8162e19cfc7b3ce25b72983c0df4de6e14cbafe.zip
service: Split reply_pending function to two parts
Split reply_pending() into two parts so that a D-Bus reply can be sent to the client waiting for a reply.
Diffstat (limited to 'src')
-rw-r--r--src/connman.h1
-rw-r--r--src/service.c33
2 files changed, 21 insertions, 13 deletions
diff --git a/src/connman.h b/src/connman.h
index cbf88fc8..49fa76d3 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -624,6 +624,7 @@ int __connman_service_disconnect(struct connman_service *service);
int __connman_service_disconnect_all(void);
void __connman_service_auto_connect(void);
gboolean __connman_service_remove(struct connman_service *service);
+void __connman_service_reply_dbus_pending(DBusMessage *pending, int error);
int __connman_service_provision_changed(const char *ident);
void __connman_service_set_config(struct connman_service *service,
diff --git a/src/service.c b/src/service.c
index 2577677f..c353e8ed 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3388,35 +3388,42 @@ static void remove_timeout(struct connman_service *service)
}
}
-static void reply_pending(struct connman_service *service, int error)
+void __connman_service_reply_dbus_pending(DBusMessage *pending, int error)
{
- remove_timeout(service);
-
- if (service->pending != NULL) {
+ if (pending != NULL) {
if (error > 0) {
DBusMessage *reply;
- reply = __connman_error_failed(service->pending,
- error);
+ reply = __connman_error_failed(pending, error);
if (reply != NULL)
g_dbus_send_message(connection, reply);
} else {
- const char *sender;
+ const char *sender, *path;
- sender = dbus_message_get_interface(service->pending);
+ sender = dbus_message_get_interface(pending);
+ path = dbus_message_get_path(pending);
- DBG("sender %s", sender);
+ DBG("sender %s path %s", sender, path);
if (g_strcmp0(sender, CONNMAN_MANAGER_INTERFACE) == 0)
- g_dbus_send_reply(connection, service->pending,
- DBUS_TYPE_OBJECT_PATH, &service->path,
+ g_dbus_send_reply(connection, pending,
+ DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID);
else
- g_dbus_send_reply(connection, service->pending,
+ g_dbus_send_reply(connection, pending,
DBUS_TYPE_INVALID);
}
- dbus_message_unref(service->pending);
+ dbus_message_unref(pending);
+ }
+}
+
+static void reply_pending(struct connman_service *service, int error)
+{
+ remove_timeout(service);
+
+ if (service->pending != NULL) {
+ __connman_service_reply_dbus_pending(service->pending, error);
service->pending = NULL;
}
}