proxygen
AcceptorHandshakeManager.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
19 
20 namespace wangle {
21 
24  acceptor_->getConnectionManager()->addConnection(this, true);
25  startHelper(std::move(sock));
26  startHandshakeTimeout();
27 }
28 
31  std::string nextProtocol,
32  SecureTransportType secureTransportType,
34  if (sslErr) {
35  acceptor_->updateSSLStats(
36  transport.get(),
37  timeSinceAcceptMs(),
38  sslErr.value());
39  }
40  acceptor_->getConnectionManager()->removeConnection(this);
41  // We pass TransportInfo by reference even though we're about to destroy it,
42  // so lets hope that anything saving it makes a copy!
43  acceptor_->sslConnectionReady(
44  std::move(transport),
45  std::move(clientAddr_),
46  std::move(nextProtocol),
47  secureTransportType,
48  tinfo_);
49  destroy();
50 }
51 
56  if (sslErr) {
57  acceptor_->updateSSLStats(
58  transport, timeSinceAcceptMs(), sslErr.value());
59  }
60  acceptor_->getConnectionManager()->removeConnection(this);
61  acceptor_->sslConnectionError(std::move(ex));
62  destroy();
63 }
64 
65 std::chrono::milliseconds AcceptorHandshakeManager::timeSinceAcceptMs() const {
66  return std::chrono::duration_cast<std::chrono::milliseconds>(
68 }
69 
71  auto handshake_timeout = acceptor_->getSSLHandshakeTimeout();
73  this, handshake_timeout);
74 }
75 
76 }
virtual void start(folly::AsyncSSLSocket::UniquePtr sock) noexcept
std::chrono::milliseconds getSSLHandshakeTimeout() const
Definition: Acceptor.h:169
std::chrono::steady_clock::time_point now()
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
requires E e noexcept(noexcept(s.error(std::move(e))))
void connectionReady(folly::AsyncTransportWrapper::UniquePtr transport, std::string nextProtocol, SecureTransportType secureTransportType, folly::Optional< SSLErrorEnum > details) noexceptoverride
static void destroy()
std::unique_ptr< AsyncSSLSocket, Destructor > UniquePtr
FizzServerAcceptor * acceptor_
std::chrono::milliseconds timeSinceAcceptMs() const
std::unique_ptr< AsyncTransportWrapper, Destructor > UniquePtr
void scheduleTimeout(ManagedConnection *const connection, std::chrono::milliseconds timeout)
std::chrono::steady_clock::time_point acceptTime_
virtual wangle::ConnectionManager * getConnectionManager()
Definition: Acceptor.h:132
const char * string
Definition: Conv.cpp:212
void connectionError(folly::AsyncTransportWrapper *transport, folly::exception_wrapper ex, folly::Optional< SSLErrorEnum > details) noexceptoverride