MCPcopy Create free account
hub / github.com/apple/foundationdb / acceptHandshakeWrapper

Method acceptHandshakeWrapper

flow/Net2.actor.cpp:937–964  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 14

nowFunction · 0.85
TraceEventClass · 0.85
delayFunction · 0.85
detailMethod · 0.80
whenFunction · 0.70
VoidClass · 0.70
getPeerAddressMethod · 0.45
findMethod · 0.45
endMethod · 0.45
toStringMethod · 0.45
closeSocketMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected