diff options
Diffstat (limited to 'src/cpp/server/secure_server_credentials.cc')
-rw-r--r-- | src/cpp/server/secure_server_credentials.cc | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/cpp/server/secure_server_credentials.cc b/src/cpp/server/secure_server_credentials.cc index 49d69a3fb9..3e262dd74f 100644 --- a/src/cpp/server/secure_server_credentials.cc +++ b/src/cpp/server/secure_server_credentials.cc @@ -31,39 +31,22 @@ * */ -#include <grpc/grpc_security.h> - -#include <grpc++/server_credentials.h> +#include "src/cpp/server/secure_server_credentials.h" namespace grpc { -namespace { -class SecureServerCredentials GRPC_FINAL : public ServerCredentials { - public: - explicit SecureServerCredentials(grpc_server_credentials* creds) - : creds_(creds) {} - ~SecureServerCredentials() GRPC_OVERRIDE { - grpc_server_credentials_release(creds_); - } - - int AddPortToServer(const grpc::string& addr, - grpc_server* server) GRPC_OVERRIDE { - return grpc_server_add_secure_http2_port(server, addr.c_str(), creds_); - } - - private: - grpc_server_credentials* const creds_; -}; -} // namespace +int SecureServerCredentials::AddPortToServer( + const grpc::string& addr, grpc_server* server) { + return grpc_server_add_secure_http2_port(server, addr.c_str(), creds_); +} std::shared_ptr<ServerCredentials> SslServerCredentials( const SslServerCredentialsOptions& options) { std::vector<grpc_ssl_pem_key_cert_pair> pem_key_cert_pairs; for (auto key_cert_pair = options.pem_key_cert_pairs.begin(); - key_cert_pair != options.pem_key_cert_pairs.end(); - key_cert_pair++) { + key_cert_pair != options.pem_key_cert_pairs.end(); key_cert_pair++) { grpc_ssl_pem_key_cert_pair p = {key_cert_pair->private_key.c_str(), - key_cert_pair->cert_chain.c_str()}; + key_cert_pair->cert_chain.c_str()}; pem_key_cert_pairs.push_back(p); } grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create( |