From da86dda95186079a79718525ad8a1d5c5a86fec3 Mon Sep 17 00:00:00 2001 From: Andrew Sweeney Date: Mon, 6 Jan 2014 20:36:31 -0500 Subject: [PATCH] evhttp_request_set_on_complete_cb to be more specific about what the function actually does and usage --- http.c | 4 ++-- include/event2/http.h | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/http.c b/http.c index b0d659b5..51470225 100644 --- a/http.c +++ b/http.c @@ -3846,10 +3846,10 @@ evhttp_request_set_error_cb(struct evhttp_request *req, void evhttp_request_set_on_complete_cb(struct evhttp_request *req, - void (*cb)(struct evhttp_request *, void *), void *arg) + void (*cb)(struct evhttp_request *, void *), void *cb_arg) { req->on_complete_cb = cb; - req->on_complete_cb_arg = arg; + req->on_complete_cb_arg = cb_arg; } /* diff --git a/include/event2/http.h b/include/event2/http.h index ff19b449..08b70f52 100644 --- a/include/event2/http.h +++ b/include/event2/http.h @@ -555,14 +555,19 @@ void evhttp_request_set_error_cb(struct evhttp_request *, void (*)(enum evhttp_request_error, void *)); /** - * Set a on request complete callback. + * Set a callback to be called on request completion of evhttp_send_* function. * - * Receive a callback on request completion. This callback is triggered once - * the request is complete and all resources associated with the request will - * be released. + * The callback function will be called on the completion of the request after + * the output data has been written and before the evhttp_request object + * is destroyed. This can be useful for tracking resources associated with a + * request (ex: timing metrics). + * + * @param req a request object + * @param cb callback function that will be called on request completion + * @param cb_arg an additional context argument for the callback */ -void evhttp_request_set_on_complete_cb(struct evhttp_request *, - void (*)(struct evhttp_request *, void *), void *); +void evhttp_request_set_on_complete_cb(struct evhttp_request *req, + void (*cb)(struct evhttp_request *, void *), void *cb_arg); /** Frees the request object and removes associated events. */ void evhttp_request_free(struct evhttp_request *req); -- 2.50.1