| 684 | } |
| 685 | |
| 686 | int 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 | |
| 711 | static void* CreateServerTLS(const void* args) { |
| 712 | return static_cast<const DataFactory*>(args)->CreateData(); |
nothing calls this directly
no test coverage detected