diff options
author | Andrew Sweeney <asweeney86@gmail.com> | 2014-01-05 20:35:46 -0500 |
---|---|---|
committer | Andrew Sweeney <asweeney86@gmail.com> | 2014-01-05 20:35:46 -0500 |
commit | b083ca0551ec8ca63245e2e78dfefd11072443fc (patch) | |
tree | bd64cb0992f55d0bb77a3d02c555933c9fdde991 /include | |
parent | 4c8ebcd3598a97004340511930b84286a52d9d05 (diff) | |
download | libevent-b083ca0551ec8ca63245e2e78dfefd11072443fc.tar.gz |
Provide on request complete callback facility
This patch provides the ability to receive a callback on the completion of a
request. The callback takes place immediately before the request's resources
are released.
Diffstat (limited to 'include')
-rw-r--r-- | include/event2/http.h | 10 | ||||
-rw-r--r-- | include/event2/http_struct.h | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/event2/http.h b/include/event2/http.h index 068120c7..ff19b449 100644 --- a/include/event2/http.h +++ b/include/event2/http.h @@ -554,6 +554,16 @@ enum evhttp_request_error { void evhttp_request_set_error_cb(struct evhttp_request *, void (*)(enum evhttp_request_error, void *)); +/** + * Set a on request complete callback. + * + * 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. + */ +void evhttp_request_set_on_complete_cb(struct evhttp_request *, + void (*)(struct evhttp_request *, void *), void *); + /** Frees the request object and removes associated events. */ void evhttp_request_free(struct evhttp_request *req); diff --git a/include/event2/http_struct.h b/include/event2/http_struct.h index 4ca196ee..4bf5b1ff 100644 --- a/include/event2/http_struct.h +++ b/include/event2/http_struct.h @@ -135,6 +135,13 @@ struct { * @see evhttp_request_set_error_cb() */ void (*error_cb)(enum evhttp_request_error, void *); + + /* + * Send complete callback - called when the request is actually + * sent and completed. + */ + void (*on_complete_cb)(struct evhttp_request *, void *); + void *on_complete_cb_arg; }; #ifdef __cplusplus |