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

Method InitALPNOptions

src/brpc/server.cpp:686–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686int Server::InitALPNOptions(const ServerSSLOptions* options) {
687 if (options == nullptr) {
688 LOG(ERROR) << "Fail to init alpn options, ssl options is nullptr.";
689 return -1;
690 }
691
692 std::string raw_protocol;
693 const std::string& alpns = options->alpns;
694 for (butil::StringSplitter split(alpns.data(), ','); split; ++split) {
695 butil::StringPiece alpn(split.field(), split.length());
696 alpn.trim_spaces();
697
698 // Check protocol valid(exist and server support)
699 AdaptiveProtocolType protocol_type(alpn);
700 const Protocol* protocol = FindProtocol(protocol_type);
701 if (protocol == nullptr || !protocol->support_server()) {
702 LOG(ERROR) << "Server does not support alpn=" << alpn;
703 return -1;
704 }
705 raw_protocol.append(ALPNProtocolToString(protocol_type));
706 }
707 _raw_alpns = std::move(raw_protocol);
708 return 0;
709}
710
711static void* CreateServerTLS(const void* args) {
712 return static_cast<const DataFactory*>(args)->CreateData();

Callers

nothing calls this directly

Calls 9

FindProtocolFunction · 0.85
ALPNProtocolToStringFunction · 0.85
fieldMethod · 0.80
trim_spacesMethod · 0.80
support_serverMethod · 0.80
moveFunction · 0.50
dataMethod · 0.45
lengthMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected