diff options
author | Mohamed Abbas <mabbas@linux.intel.com> | 2011-11-15 13:06:15 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-11-15 13:41:44 +0100 |
commit | 36f57036dcf4faf2327709be40aef2e9fa0209d5 (patch) | |
tree | ce235455eb13076d713d7f4b97cabaadde67381b /src/task.c | |
parent | c75a3bd3b009b8894fa14d130709642d1bc0c8c6 (diff) | |
download | connman-36f57036dcf4faf2327709be40aef2e9fa0209d5.tar.gz connman-36f57036dcf4faf2327709be40aef2e9fa0209d5.tar.bz2 connman-36f57036dcf4faf2327709be40aef2e9fa0209d5.zip |
task: Allow vpn plugins to send reply
Change task notify to allow client to send dbus reply. This
will allow vpn plugin to send requested user/password info.
Diffstat (limited to 'src/task.c')
-rw-r--r-- | src/task.c | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -372,6 +372,7 @@ static DBusHandlerResult task_filter(DBusConnection *connection, struct connman_task *task; struct notify_data *notify; const char *path, *member; + DBusMessage *reply = NULL; if (dbus_message_get_type(message) != DBUS_MESSAGE_TYPE_METHOD_CALL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; @@ -388,29 +389,32 @@ static DBusHandlerResult task_filter(DBusConnection *connection, if (task == NULL) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - if (dbus_message_get_no_reply(message) == FALSE) { - DBusMessage *reply; + member = dbus_message_get_member(message); + if (member == NULL) + goto send_reply; + + notify = g_hash_table_lookup(task->notify, member); + if (notify == NULL) + goto send_reply; + + if (notify->func) + reply = notify->func(task, message, notify->data); + +send_reply: + if (dbus_message_get_no_reply(message) == FALSE && + reply == NULL) { reply = dbus_message_new_method_return(message); if (reply == NULL) return DBUS_HANDLER_RESULT_NEED_MEMORY; + } + if (reply != NULL) { dbus_connection_send(connection, reply, NULL); dbus_message_unref(reply); } - member = dbus_message_get_member(message); - if (member == NULL) - return DBUS_HANDLER_RESULT_HANDLED; - - notify = g_hash_table_lookup(task->notify, member); - if (notify == NULL) - return DBUS_HANDLER_RESULT_HANDLED; - - if (notify->func) - notify->func(task, message, notify->data); - return DBUS_HANDLER_RESULT_HANDLED; } |