MCPcopy Create free account
hub / github.com/3rdparty/libprocess / accept_callback

Method accept_callback

src/posix/libevent/libevent_ssl_socket.cpp:1098–1126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1096
1097
1098void LibeventSSLSocketImpl::accept_callback(AcceptRequest* request)
1099{
1100 CHECK(__in_event_loop__);
1101
1102 Queue<Future<std::shared_ptr<SocketImpl>>> accept_queue_ = accept_queue;
1103
1104 // After the socket is accepted, it must complete the SSL
1105 // handshake (or be downgraded to a regular socket) before
1106 // we put it in the queue of connected sockets.
1107 request->promise.future()
1108 .onAny([accept_queue_](Future<std::shared_ptr<SocketImpl>> impl) mutable {
1109 accept_queue_.put(impl);
1110 });
1111
1112 // If we support downgrading the connection, first wait for this
1113 // socket to become readable. We will then MSG_PEEK it to test
1114 // whether we want to dispatch as SSL or non-SSL.
1115 if (openssl::flags().support_downgrade) {
1116 request->peek_event = event_new(
1117 base,
1118 request->socket,
1119 EV_READ,
1120 &LibeventSSLSocketImpl::peek_callback,
1121 request);
1122 event_add(request->peek_event, nullptr);
1123 } else {
1124 accept_SSL_callback(request);
1125 }
1126}
1127
1128
1129void LibeventSSLSocketImpl::accept_SSL_callback(AcceptRequest* request)

Callers 1

listenMethod · 0.80

Calls 2

futureMethod · 0.80
putMethod · 0.80

Tested by

no test coverage detected