Commit 1f1d9662 authored by Orvid King's avatar Orvid King Committed by Facebook Github Bot

NetworkSocket support for AsyncSSLSocket

Summary: More things.

Reviewed By: yfeldblum

Differential Revision: D12818556

fbshipit-source-id: 8e839489eb92a3ec3f0ac391c157ad3de42d596b
parent e47087b7
...@@ -239,7 +239,7 @@ AsyncSSLSocket::AsyncSSLSocket( ...@@ -239,7 +239,7 @@ AsyncSSLSocket::AsyncSSLSocket(
AsyncSSLSocket::AsyncSSLSocket( AsyncSSLSocket::AsyncSSLSocket(
const shared_ptr<SSLContext>& ctx, const shared_ptr<SSLContext>& ctx,
EventBase* evb, EventBase* evb,
int fd, NetworkSocket fd,
bool server, bool server,
bool deferSecurityNegotiation) bool deferSecurityNegotiation)
: AsyncSocket(evb, fd), : AsyncSocket(evb, fd),
...@@ -300,7 +300,7 @@ AsyncSSLSocket::AsyncSSLSocket( ...@@ -300,7 +300,7 @@ AsyncSSLSocket::AsyncSSLSocket(
AsyncSSLSocket::AsyncSSLSocket( AsyncSSLSocket::AsyncSSLSocket(
const shared_ptr<SSLContext>& ctx, const shared_ptr<SSLContext>& ctx,
EventBase* evb, EventBase* evb,
int fd, NetworkSocket fd,
const std::string& serverName, const std::string& serverName,
bool deferSecurityNegotiation) bool deferSecurityNegotiation)
: AsyncSSLSocket(ctx, evb, fd, false, deferSecurityNegotiation) { : AsyncSSLSocket(ctx, evb, fd, false, deferSecurityNegotiation) {
......
...@@ -221,6 +221,18 @@ class AsyncSSLSocket : public virtual AsyncSocket { ...@@ -221,6 +221,18 @@ class AsyncSSLSocket : public virtual AsyncSocket {
EventBase* evb, EventBase* evb,
int fd, int fd,
bool server = true, bool server = true,
bool deferSecurityNegotiation = false)
: AsyncSSLSocket(
ctx,
evb,
NetworkSocket::fromFd(fd),
server,
deferSecurityNegotiation) {}
AsyncSSLSocket(
const std::shared_ptr<folly::SSLContext>& ctx,
EventBase* evb,
NetworkSocket fd,
bool server = true,
bool deferSecurityNegotiation = false); bool deferSecurityNegotiation = false);
/** /**
...@@ -239,7 +251,7 @@ class AsyncSSLSocket : public virtual AsyncSocket { ...@@ -239,7 +251,7 @@ class AsyncSSLSocket : public virtual AsyncSocket {
static std::shared_ptr<AsyncSSLSocket> newSocket( static std::shared_ptr<AsyncSSLSocket> newSocket(
const std::shared_ptr<folly::SSLContext>& ctx, const std::shared_ptr<folly::SSLContext>& ctx,
EventBase* evb, EventBase* evb,
int fd, NetworkSocket fd,
bool server = true, bool server = true,
bool deferSecurityNegotiation = false) { bool deferSecurityNegotiation = false) {
return std::shared_ptr<AsyncSSLSocket>( return std::shared_ptr<AsyncSSLSocket>(
...@@ -247,6 +259,16 @@ class AsyncSSLSocket : public virtual AsyncSocket { ...@@ -247,6 +259,16 @@ class AsyncSSLSocket : public virtual AsyncSocket {
Destructor()); Destructor());
} }
static std::shared_ptr<AsyncSSLSocket> newSocket(
const std::shared_ptr<folly::SSLContext>& ctx,
EventBase* evb,
int fd,
bool server = true,
bool deferSecurityNegotiation = false) {
return newSocket(
ctx, evb, NetworkSocket::fromFd(fd), server, deferSecurityNegotiation);
}
/** /**
* Helper function to create a client shared_ptr<AsyncSSLSocket>. * Helper function to create a client shared_ptr<AsyncSSLSocket>.
*/ */
...@@ -287,9 +309,21 @@ class AsyncSSLSocket : public virtual AsyncSocket { ...@@ -287,9 +309,21 @@ class AsyncSSLSocket : public virtual AsyncSocket {
AsyncSSLSocket( AsyncSSLSocket(
const std::shared_ptr<folly::SSLContext>& ctx, const std::shared_ptr<folly::SSLContext>& ctx,
EventBase* evb, EventBase* evb,
int fd, NetworkSocket fd,
const std::string& serverName, const std::string& serverName,
bool deferSecurityNegotiation = false); bool deferSecurityNegotiation = false);
AsyncSSLSocket(
const std::shared_ptr<folly::SSLContext>& ctx,
EventBase* evb,
int fd,
const std::string& serverName,
bool deferSecurityNegotiation = false)
: AsyncSSLSocket(
ctx,
evb,
NetworkSocket::fromFd(fd),
serverName,
deferSecurityNegotiation) {}
static std::shared_ptr<AsyncSSLSocket> newSocket( static std::shared_ptr<AsyncSSLSocket> newSocket(
const std::shared_ptr<folly::SSLContext>& ctx, const std::shared_ptr<folly::SSLContext>& ctx,
......
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