Make done event on node

Replace the AsyncDone event with an explicit done callback in the node
to signal completion of an async operation.
Pass read and write fd together with the transport
This commit is contained in:
Wim Taymans 2017-06-09 17:24:18 +02:00
parent 0af8377d10
commit 34450ed7ed
24 changed files with 268 additions and 254 deletions

View file

@ -88,11 +88,11 @@ static int impl_node_set_props(struct spa_node *node, const struct spa_props *pr
return SPA_RESULT_OK;
}
static int do_send_event(struct spa_loop *loop, bool async, uint32_t seq, size_t size, void *data, void *user_data)
static int do_send_done(struct spa_loop *loop, bool async, uint32_t seq, size_t size, void *data, void *user_data)
{
struct state *this = user_data;
this->callbacks.event(&this->node, data, this->user_data);
this->callbacks.done(&this->node, seq, *(int*)data, this->user_data);
return SPA_RESULT_OK;
}
@ -111,11 +111,10 @@ static int do_command(struct spa_loop *loop, bool async, uint32_t seq, size_t si
if (async) {
spa_loop_invoke(this->main_loop,
do_send_event,
SPA_ID_INVALID,
sizeof(struct spa_event_node_async_complete),
&SPA_EVENT_NODE_ASYNC_COMPLETE_INIT(this->type.event_node.AsyncComplete,
seq, res),
do_send_done,
seq,
sizeof(res),
&res,
this);
}
return res;