From: Andrew Sweeney Date: Tue, 7 Jan 2014 01:36:31 +0000 (-0500) Subject: evhttp_request_set_on_complete_cb to be more specific about what the function actuall... X-Git-Tag: release-2.1.4-alpha~50^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da86dda95186079a79718525ad8a1d5c5a86fec3;p=libevent evhttp_request_set_on_complete_cb to be more specific about what the function actually does and usage --- 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);