-
Notifications
You must be signed in to change notification settings - Fork 10
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
prevent leaking of CURL handles #36
Conversation
user_data_on_write_ = data; | ||
return CURLE_OK; | ||
} | ||
class SingleRequestMockCurlLibrary : public CurlLibrary { |
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 code is moved and renamed from the class MockCurlLibrary
that used to be in the TEST_CASE("parse response headers and body")
. It's used there and in the new test case.
I also added data members created_handles_
, destroyed_handles_
, message_result_
, and delay_message_
.
// Here are the checks relevant to this test. | ||
REQUIRE(library.created_handles_.size() == 1); | ||
REQUIRE(library.created_handles_ == library.destroyed_handles_); |
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.
The SECTION
s above are all setup. The post-condition, here, is always the same: one handle created and one handle destroyed.
I find that "hide whitespace" in the diff gearbox menu improves the diff. |
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.
Seems OK, marking as approved.
Are there any consequences to doing this with a request in-flight?
Thanks!
Nope, removing the easy handle from the multi-handle (event loop) unregisters it from anything that would drive its installed callbacks. Then cleaning up the easy handle frees resources. |
See #31.
In addition to the recommended change, this revision also adds unit tests that verify that a CURL handle, once created, is destroyed.