typedef void (* connman_task_exit_t) (struct connman_task *task,
int exit_code, void *user_data);
-typedef void (* connman_task_notify_t) (struct connman_task *task,
+typedef DBusMessage * (* connman_task_notify_t) (struct connman_task *task,
DBusMessage *message, void *user_data);
struct connman_task *connman_task_create(const char *program);
data->flags = flags;
}
-static void vpn_notify(struct connman_task *task,
+static DBusMessage *vpn_notify(struct connman_task *task,
DBusMessage *msg, void *user_data)
{
struct connman_provider *provider = user_data;
name = connman_provider_get_driver_name(provider);
if (name == NULL)
- return;
+ return NULL;
vpn_driver_data = g_hash_table_lookup(driver_hash, name);
if (vpn_driver_data == NULL)
- return;
+ return NULL;
state = vpn_driver_data->vpn_driver->notify(msg, provider);
switch (state) {
CONNMAN_PROVIDER_ERROR_AUTH_FAILED);
break;
}
+
+ return NULL;
}
static int vpn_create_tun(struct connman_provider *provider)
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;
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;
}