struct l_dbus *dbus;
struct l_timeout *timeout;
l_dbus_message_func_t cb;
+ l_dbus_destroy_func_t destroy;
void *user_data;
uint32_t serial;
};
l_timeout_remove(info->timeout);
info->cb(message, info->user_data);
+
+ if (info->destroy)
+ info->destroy(info->user_data);
+
l_free(info);
}
void dbus_send_with_timeout(struct l_dbus *dbus, struct l_dbus_message *msg,
l_dbus_message_func_t cb,
void *user_data,
+ l_dbus_destroy_func_t destroy,
unsigned int seconds)
{
struct send_info *info = l_new(struct send_info, 1);
info->dbus = dbus;
info->cb = cb;
info->user_data = user_data;
+ info->destroy = destroy;
info->serial = l_dbus_send_with_reply(dbus, msg, send_reply,
info, NULL);
info->timeout = l_timeout_create(seconds, send_timeout, info, NULL);
void dbus_send_with_timeout(struct l_dbus *dbus, struct l_dbus_message *msg,
l_dbus_message_func_t cb,
void *user_data,
+ l_dbus_destroy_func_t destroy,
unsigned int seconds);
free_pending_join_call(true);
}
-static void prov_join_complete_reply_cb(struct l_dbus_message *message,
+static void prov_join_complete_reply_cb(struct l_dbus_message *msg,
void *user_data)
{
bool failed = false;
- if (!message || l_dbus_message_is_error(message))
+ if (!msg || l_dbus_message_is_error(msg))
failed = true;
if (!failed)
l_dbus_message_set_arguments(msg, "t", l_get_be64(token));
dbus_send_with_timeout(dbus, msg, prov_join_complete_reply_cb,
- NULL, DEFAULT_DBUS_TIMEOUT);
+ NULL, NULL, DEFAULT_DBUS_TIMEOUT);
return true;
}
}
#endif
-static void create_join_complete_reply_cb(struct l_dbus_message *message,
+static void create_join_complete_reply_cb(struct l_dbus_message *msg,
void *user_data)
{
struct mesh_node *node = user_data;
- if (!message || l_dbus_message_is_error(message)) {
+ if (!msg || l_dbus_message_is_error(msg)) {
node_remove(node);
return;
}
l_dbus_message_set_arguments(msg, "t", l_get_be64(token));
dbus_send_with_timeout(dbus, msg, create_join_complete_reply_cb,
- node, DEFAULT_DBUS_TIMEOUT);
+ node, NULL, DEFAULT_DBUS_TIMEOUT);
l_dbus_message_unref(pending_msg);
}