Commit bd600cd4 authored by Andrii Grynenko's avatar Andrii Grynenko Committed by Facebook GitHub Bot

Move ReleasableDestructor into HeaderClientChannel

Summary: Since HeaderClientChannel now accepts a transport unique_ptr there's no need to have this deleter exposed outside of HeaderClientChannel.

Reviewed By: iahs

Differential Revision: D27729209

fbshipit-source-id: 064b03afdfe567b6df6437348596f0f6f97f6aaf
parent cd3552c1
......@@ -75,7 +75,7 @@ class AsyncSSLSocketConnector;
*/
class AsyncSSLSocket : public AsyncSocket {
public:
typedef std::unique_ptr<AsyncSSLSocket, ReleasableDestructor> UniquePtr;
typedef std::unique_ptr<AsyncSSLSocket, Destructor> UniquePtr;
using X509_deleter = folly::static_function_deleter<X509, &X509_free>;
class HandshakeCB {
......
......@@ -77,31 +77,7 @@ namespace folly {
class AsyncSocket : public AsyncTransport {
public:
/**
* Use ReleasableDestructor with AsyncSocket to enable transferring the
* ownership of the socket owned by smart pointers.
*/
class ReleasableDestructor : public DelayedDestruction::Destructor {
public:
void operator()(DelayedDestruction* dd) const {
if (!released_) {
dd->destroy();
}
}
/**
* Release the object managed by smart pointers. This is used when the
* object ownership is transferred to another smart pointer or manually
* managed by the caller. The original object must be properly deleted at
* the end of its life cycle to avoid resource leaks.
*/
void release() { released_ = true; }
private:
bool released_{false};
};
using UniquePtr = std::unique_ptr<AsyncSocket, ReleasableDestructor>;
using UniquePtr = std::unique_ptr<AsyncSocket, Destructor>;
class ConnectCallback {
public:
......
......@@ -2612,8 +2612,7 @@ TEST(AsyncSSLSocketTest, TTLSDisabled) {
class MockAsyncTFOSSLSocket : public AsyncSSLSocket {
public:
using UniquePtr =
std::unique_ptr<MockAsyncTFOSSLSocket, ReleasableDestructor>;
using UniquePtr = std::unique_ptr<MockAsyncTFOSSLSocket, Destructor>;
explicit MockAsyncTFOSSLSocket(
std::shared_ptr<folly::SSLContext> sslCtx, EventBase* evb)
......
......@@ -26,7 +26,7 @@ namespace test {
class MockAsyncSocket : public AsyncSocket {
public:
typedef std::unique_ptr<MockAsyncSocket, ReleasableDestructor> UniquePtr;
typedef std::unique_ptr<MockAsyncSocket, Destructor> UniquePtr;
explicit MockAsyncSocket(EventBase* base) : AsyncSocket(base) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment