/**
* No memory in between
*/
- TEVENT_REQ_NO_MEMORY
+ TEVENT_REQ_NO_MEMORY,
+ /**
+ * the request is already received by the caller
+ */
+ TEVENT_REQ_RECEIVED
};
/**
enum tevent_req_state *state,
uint64_t *error);
+void tevent_req_received(struct tevent_req *req);
+
struct tevent_req *tevent_wakeup_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct timeval wakeup_time);
/**
* @brief A function to overwrite the default print function
*
- * The implementation doing the work may want to imeplement a
+ * The implementation doing the work may want to implement a
* custom function to print the text representation of the async
* request.
*/
return false;
}
+/**
+ * @brief This function destroys the attached private data
+ * @param[in] req The finished request
+ *
+ * This function can be called as last action of a _recv()
+ * function, it destroys the data attached to the tevent_req.
+ */
+void tevent_req_received(struct tevent_req *req)
+{
+ talloc_free(req->data);
+ req->data = NULL;
+ req->private_print = NULL;
+
+ talloc_free(req->internal.trigger);
+ req->internal.trigger = NULL;
+ talloc_free(req->internal.timer);
+ req->internal.timer = NULL;
+
+ req->internal.state = TEVENT_REQ_RECEIVED;
+}
+
bool tevent_req_poll(struct tevent_req *req,
struct tevent_context *ev)
{