MCPcopy Create free account
hub / github.com/apache/brpc / SetServerALPNCallback

Function SetServerALPNCallback

src/brpc/details/ssl_helper.cpp:518–533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

516}
517
518static int SetServerALPNCallback(SSL_CTX* ssl_ctx, const std::string* alpns) {
519 if (ssl_ctx == nullptr) {
520 LOG(ERROR) << "Fail to set server ALPN callback, ssl_ctx is nullptr.";
521 return -1;
522 }
523
524 // Server set alpn callback when openssl version is more than 1.0.2
525#if (OPENSSL_VERSION_NUMBER >= SSL_VERSION_NUMBER(1, 0, 2))
526 SSL_CTX_set_alpn_select_cb(ssl_ctx, ServerALPNCallback,
527 const_cast<std::string*>(alpns));
528#else
529 LOG(WARNING) << "OpenSSL version=" << OPENSSL_VERSION_STR
530 << " is lower than 1.0.2, ignore server alpn.";
531#endif
532 return 0;
533}
534
535SSL_CTX* CreateClientSSLContext(const ChannelSSLOptions& options) {
536 std::unique_ptr<SSL_CTX, FreeSSLCTX> ssl_ctx(

Callers 1

CreateServerSSLContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected