| 307 | } |
| 308 | |
| 309 | static int CreateSocketSSLContext(const ChannelOptions& options, |
| 310 | std::shared_ptr<SocketSSLContext>* ssl_ctx) { |
| 311 | if (options.has_ssl_options()) { |
| 312 | SSL_CTX* raw_ctx = CreateClientSSLContext(options.ssl_options()); |
| 313 | if (!raw_ctx) { |
| 314 | LOG(ERROR) << "Fail to CreateClientSSLContext"; |
| 315 | return -1; |
| 316 | } |
| 317 | *ssl_ctx = std::make_shared<SocketSSLContext>(); |
| 318 | (*ssl_ctx)->raw_ctx = raw_ctx; |
| 319 | (*ssl_ctx)->sni_name = options.ssl_options().sni_name; |
| 320 | (*ssl_ctx)->alpn_protocols = options.ssl_options().alpn_protocols; |
| 321 | } else { |
| 322 | (*ssl_ctx) = NULL; |
| 323 | } |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | int Channel::Init(butil::EndPoint server_addr_and_port, |
| 328 | const ChannelOptions* options) { |
no test coverage detected