-AsyncSSLSocket::AsyncSSLSocket(const shared_ptr<SSLContext>& ctx,
- EventBase* evb, int fd, bool server,
- bool deferSecurityNegotiation) :
- AsyncSocket(evb, fd),
- server_(server),
- ctx_(ctx),
- handshakeTimeout_(this, evb),
- connectionTimeout_(this, evb) {
+AsyncSSLSocket::AsyncSSLSocket(
+ const shared_ptr<SSLContext>& ctx,
+ EventBase* evb,
+ int fd,
+ bool server,
+ bool deferSecurityNegotiation)
+ : AsyncSocket(evb, fd),
+ server_(server),
+ ctx_(ctx),
+ handshakeTimeout_(this, evb),
+ connectionTimeout_(this, evb) {
+ noTransparentTls_ = true;
+ init();
+ if (server) {
+ SSL_CTX_set_info_callback(
+ ctx_->getSSLCtx(), AsyncSSLSocket::sslInfoCallback);
+ }
+ if (deferSecurityNegotiation) {
+ sslState_ = STATE_UNENCRYPTED;
+ }
+}
+
+AsyncSSLSocket::AsyncSSLSocket(
+ const shared_ptr<SSLContext>& ctx,
+ AsyncSocket::UniquePtr oldAsyncSocket,
+ bool server,
+ bool deferSecurityNegotiation)
+ : AsyncSocket(std::move(oldAsyncSocket)),
+ server_(server),
+ ctx_(ctx),
+ handshakeTimeout_(this, AsyncSocket::getEventBase()),
+ connectionTimeout_(this, AsyncSocket::getEventBase()) {
+ noTransparentTls_ = true;