-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Added evhttp request on free callback #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added evhttp request on free callback #591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plus this change will need a unit test.
Also would you mind to change the documentation to address issues that you found in #589?
e9f13c6
to
63a6193
Compare
This patch is what I want |
I meant that we need to document order/cases in which callbacks will be called, so that it will be possible to figure this out without looking into sources, and since you adding yet another callback (and I assume that already look into all available callbacks in http and your knowledge was fresh, egh was cause it passed almost year since this pull request had been submitted) I would love to see separate patch that documents this. |
/* | ||
* Free callback - called just before the request is freed. | ||
*/ | ||
void (*on_free_cb)(struct evhttp_request *, void *); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an ABI break. The soname needs to be bumped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually using evhttp_request
directly is not recommended, but yes it is.
And there is a comment in this file:
Data structures for http. Using these structures may hurt forward
compatibility with later versions of Libevent: be careful!
But nobody reads headers
@pprindeville I'm really sorry for abandoning this, sadly, but I haven't have enough time for libevent for a long time already. |
This adds a callback from
evhttp_request_free()
that guarantees resources associated with anevhttp_request
can be deallocated. I found this necessary because the on complete and on error callbacks are not always called which can lead to memory leaks. This callback makes the resource deallocation explicit.