diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-06-15 16:00:20 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-06-18 10:56:52 +0300 |
commit | 3ca789e446848eed6ca3c00af080cd737d115dcb (patch) | |
tree | a535d92aa25341b6d8345901adff8652cee87f08 /src | |
parent | b8162e19cfc7b3ce25b72983c0df4de6e14cbafe (diff) | |
download | connman-3ca789e446848eed6ca3c00af080cd737d115dcb.tar.gz connman-3ca789e446848eed6ca3c00af080cd737d115dcb.tar.bz2 connman-3ca789e446848eed6ca3c00af080cd737d115dcb.zip |
service: Add support functions for pending replies
Diffstat (limited to 'src')
-rw-r--r-- | src/connman.h | 4 | ||||
-rw-r--r-- | src/service.c | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/connman.h b/src/connman.h index 49fa76d3..db3934d2 100644 --- a/src/connman.h +++ b/src/connman.h @@ -624,6 +624,10 @@ 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_set_hidden_data(struct connman_service *service, + gpointer user_data); +void __connman_service_return_error(struct connman_service *service, + int error, gpointer user_data); void __connman_service_reply_dbus_pending(DBusMessage *pending, int error); int __connman_service_provision_changed(const char *ident); diff --git a/src/service.c b/src/service.c index c353e8ed..a3a0160a 100644 --- a/src/service.c +++ b/src/service.c @@ -3428,6 +3428,38 @@ static void reply_pending(struct connman_service *service, int error) } } +static void check_pending_msg(struct connman_service *service) +{ + if (service->pending == NULL) + return; + + DBG("service %p pending msg %p already exists", service, + service->pending); + dbus_message_unref(service->pending); +} + +void __connman_service_set_hidden_data(struct connman_service *service, + gpointer user_data) +{ + DBusMessage *pending = user_data; + + DBG("service %p pending %p", service, pending); + + check_pending_msg(service); + + service->pending = pending; +} + +void __connman_service_return_error(struct connman_service *service, + int error, gpointer user_data) +{ + DBG("service %p error %d user_data %p", service, error, user_data); + + __connman_service_set_hidden_data(service, user_data); + + reply_pending(service, error); +} + static gboolean connect_timeout(gpointer user_data) { struct connman_service *service = user_data; |