| 935 | } |
| 936 | |
| 937 | ACTOR static Future<Void> acceptHandshakeWrapper(Reference<SSLConnection> self) { |
| 938 | state std::pair<IPAddress, uint16_t> peerIP; |
| 939 | peerIP = std::make_pair(self->getPeerAddress().ip, static_cast<uint16_t>(0)); |
| 940 | auto iter(g_network->networkInfo.serverTLSConnectionThrottler.find(peerIP)); |
| 941 | if (iter != g_network->networkInfo.serverTLSConnectionThrottler.end()) { |
| 942 | if (now() < iter->second.second) { |
| 943 | if (iter->second.first >= FLOW_KNOBS->TLS_SERVER_CONNECTION_THROTTLE_ATTEMPTS) { |
| 944 | TraceEvent("TLSIncomingConnectionThrottlingWarning") |
| 945 | .suppressFor(1.0) |
| 946 | .detail("PeerIP", peerIP.first.toString()); |
| 947 | wait(delay(FLOW_KNOBS->CONNECTION_MONITOR_TIMEOUT)); |
| 948 | self->closeSocket(); |
| 949 | throw connection_failed(); |
| 950 | } |
| 951 | } else { |
| 952 | g_network->networkInfo.serverTLSConnectionThrottler.erase(peerIP); |
| 953 | } |
| 954 | } |
| 955 | |
| 956 | wait(g_network->networkInfo.handshakeLock->take()); |
| 957 | state FlowLock::Releaser releaser(*g_network->networkInfo.handshakeLock); |
| 958 | |
| 959 | Promise<Void> connected; |
| 960 | doAcceptHandshake(self, connected); |
| 961 | try { |
| 962 | choose { |
| 963 | when(wait(connected.getFuture())) { return Void(); } |
| 964 | when(wait(delay(FLOW_KNOBS->CONNECTION_MONITOR_TIMEOUT))) { throw connection_failed(); } |
| 965 | } |
| 966 | } catch (Error& e) { |
| 967 | if (e.code() != error_code_actor_cancelled) { |
nothing calls this directly
no test coverage detected