grpc 1.25.0 → 1.26.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +782 -291
- data/include/grpc/impl/codegen/grpc_types.h +4 -0
- data/include/grpc/impl/codegen/port_platform.h +7 -0
- data/include/grpc/support/alloc.h +0 -16
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -2
- data/src/core/ext/filters/client_channel/backup_poller.cc +1 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -2
- data/src/core/ext/filters/client_channel/client_channel.cc +95 -88
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +7 -7
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +4 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -3
- data/src/core/ext/filters/client_channel/connector.h +40 -45
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +10 -10
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -13
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +66 -37
- data/src/core/ext/filters/client_channel/http_proxy.cc +107 -116
- data/src/core/ext/filters/client_channel/http_proxy.h +5 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy.h +9 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +10 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +18 -19
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +4 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +6 -9
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +368 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +157 -77
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +5 -5
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +8 -8
- data/src/core/ext/filters/client_channel/proxy_mapper.h +14 -34
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +46 -79
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +23 -17
- data/src/core/ext/filters/client_channel/resolver.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver.h +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +13 -10
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +3 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +9 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +17 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +9 -9
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver_factory.h +3 -3
- data/src/core/ext/filters/client_channel/resolver_registry.cc +14 -12
- data/src/core/ext/filters/client_channel/resolver_registry.h +6 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -6
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +6 -6
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +5 -5
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +3 -3
- data/src/core/ext/filters/client_channel/service_config.cc +15 -14
- data/src/core/ext/filters/client_channel/service_config.h +14 -19
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -36
- data/src/core/ext/filters/client_channel/subchannel.h +11 -12
- data/src/core/ext/filters/client_channel/subchannel_interface.h +1 -1
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +19 -9
- data/src/core/ext/filters/client_channel/xds/xds_api.h +19 -9
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +3 -3
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +6 -5
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +58 -31
- data/src/core/ext/filters/client_channel/xds/xds_client.h +20 -15
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.cc +5 -3
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +18 -15
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +10 -10
- data/src/core/ext/filters/deadline/deadline_filter.cc +15 -13
- data/src/core/ext/filters/http/client/http_client_filter.cc +12 -12
- data/src/core/ext/filters/http/client_authority_filter.cc +3 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +13 -7
- data/src/core/ext/filters/http/server/http_server_filter.cc +14 -13
- data/src/core/ext/filters/max_age/max_age_filter.cc +16 -14
- data/src/core/ext/filters/message_size/message_size_filter.cc +10 -8
- data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +9 -8
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +141 -174
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +31 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +7 -6
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +14 -12
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +8 -5
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +46 -38
- data/src/core/ext/transport/chttp2/transport/context_list.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +0 -5
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +11 -8
- data/src/core/ext/transport/chttp2/transport/internal.h +3 -3
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -2
- data/src/core/ext/transport/inproc/inproc_transport.cc +65 -41
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +141 -70
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +352 -118
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +8 -4
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +65 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +16 -2
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +12 -5
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +34 -0
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +13 -12
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +28 -24
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +5 -4
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +13 -0
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +23 -23
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +48 -44
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/type/http.upb.c +16 -0
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +36 -0
- data/src/core/ext/upb-generated/envoy/type/percent.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/type/range.upb.c +0 -1
- data/src/core/lib/avl/avl.cc +1 -1
- data/src/core/lib/channel/channel_stack.cc +1 -1
- data/src/core/lib/channel/channel_stack.h +16 -4
- data/src/core/lib/channel/channel_trace.cc +4 -4
- data/src/core/lib/channel/channelz.cc +46 -46
- data/src/core/lib/channel/channelz.h +37 -35
- data/src/core/lib/channel/channelz_registry.cc +2 -2
- data/src/core/lib/channel/channelz_registry.h +1 -1
- data/src/core/lib/channel/connected_channel.cc +3 -2
- data/src/core/lib/channel/handshaker.cc +1 -1
- data/src/core/lib/channel/handshaker_registry.cc +5 -5
- data/src/core/lib/channel/handshaker_registry.h +3 -3
- data/src/core/lib/compression/message_compress.cc +3 -2
- data/src/core/lib/compression/stream_compression_identity.cc +5 -7
- data/src/core/lib/gpr/alloc.cc +4 -29
- data/src/core/lib/gpr/cpu_linux.cc +1 -1
- data/src/core/lib/gprpp/fork.cc +4 -4
- data/src/core/lib/gprpp/global_config_env.cc +7 -7
- data/src/core/lib/gprpp/global_config_env.h +2 -2
- data/src/core/lib/gprpp/host_port.cc +8 -8
- data/src/core/lib/gprpp/host_port.h +3 -3
- data/src/core/lib/gprpp/inlined_vector.h +13 -0
- data/src/core/lib/gprpp/map.h +2 -9
- data/src/core/lib/gprpp/memory.h +12 -98
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +3 -3
- data/src/core/lib/gprpp/ref_counted_ptr.h +1 -1
- data/src/core/lib/gprpp/string_view.h +45 -23
- data/src/core/lib/gprpp/thd.h +1 -1
- data/src/core/lib/gprpp/thd_posix.cc +6 -5
- data/src/core/lib/gprpp/thd_windows.cc +3 -3
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli_security_connector.cc +3 -3
- data/src/core/lib/iomgr/buffer_list.cc +10 -5
- data/src/core/lib/iomgr/call_combiner.cc +7 -6
- data/src/core/lib/iomgr/call_combiner.h +4 -3
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -2
- data/src/core/lib/iomgr/closure.h +33 -135
- data/src/core/lib/iomgr/combiner.cc +10 -17
- data/src/core/lib/iomgr/combiner.h +0 -2
- data/src/core/lib/iomgr/endpoint_cfstream.cc +2 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -2
- data/src/core/lib/iomgr/ev_epollex_linux.cc +23 -13
- data/src/core/lib/iomgr/ev_poll_posix.cc +30 -17
- data/src/core/lib/iomgr/exec_ctx.cc +52 -5
- data/src/core/lib/iomgr/exec_ctx.h +6 -2
- data/src/core/lib/iomgr/executor.cc +16 -37
- data/src/core/lib/iomgr/executor.h +4 -7
- data/src/core/lib/iomgr/executor/threadpool.cc +4 -4
- data/src/core/lib/iomgr/iomgr_custom.cc +1 -1
- data/src/core/lib/iomgr/lockfree_event.cc +9 -8
- data/src/core/lib/iomgr/logical_thread.cc +103 -0
- data/src/core/lib/iomgr/logical_thread.h +52 -0
- data/src/core/lib/iomgr/pollset_custom.cc +5 -5
- data/src/core/lib/iomgr/pollset_set_custom.cc +9 -9
- data/src/core/lib/iomgr/pollset_windows.cc +16 -2
- data/src/core/lib/iomgr/port.h +3 -0
- data/src/core/lib/iomgr/resolve_address_custom.cc +4 -4
- data/src/core/lib/iomgr/resolve_address_posix.cc +8 -9
- data/src/core/lib/iomgr/resolve_address_windows.cc +4 -6
- data/src/core/lib/iomgr/resource_quota.cc +26 -21
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +11 -0
- data/src/core/lib/iomgr/socket_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_custom.cc +10 -9
- data/src/core/lib/iomgr/tcp_posix.cc +19 -15
- data/src/core/lib/iomgr/tcp_server_custom.cc +3 -2
- data/src/core/lib/iomgr/tcp_server_posix.cc +5 -4
- data/src/core/lib/iomgr/tcp_server_windows.cc +5 -3
- data/src/core/lib/iomgr/tcp_windows.cc +16 -13
- data/src/core/lib/iomgr/timer_custom.cc +4 -3
- data/src/core/lib/iomgr/timer_generic.cc +11 -9
- data/src/core/lib/iomgr/udp_server.cc +16 -13
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +8 -5
- data/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +45 -57
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +7 -6
- data/src/core/lib/security/credentials/credentials.cc +8 -8
- data/src/core/lib/security/credentials/credentials.h +5 -5
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -5
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -1
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +4 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -4
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -2
- data/src/core/lib/security/credentials/local/local_credentials.cc +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +13 -11
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +4 -4
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +5 -5
- data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +2 -2
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +28 -22
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +5 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -10
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +2 -1
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +8 -8
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +9 -9
- data/src/core/lib/security/security_connector/ssl_utils.cc +5 -4
- data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +14 -15
- data/src/core/lib/security/transport/client_auth_filter.cc +4 -3
- data/src/core/lib/security/transport/secure_endpoint.cc +9 -8
- data/src/core/lib/security/transport/security_handshaker.cc +67 -23
- data/src/core/lib/security/transport/server_auth_filter.cc +6 -5
- data/src/core/lib/security/transport/target_authority_table.h +1 -1
- data/src/core/lib/slice/b64.cc +3 -4
- data/src/core/lib/slice/b64.h +1 -2
- data/src/core/lib/slice/slice.cc +8 -13
- data/src/core/lib/surface/call.cc +19 -19
- data/src/core/lib/surface/call.h +6 -7
- data/src/core/lib/surface/call_log_batch.cc +1 -2
- data/src/core/lib/surface/channel.cc +17 -18
- data/src/core/lib/surface/channel.h +4 -19
- data/src/core/lib/surface/channel_ping.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +21 -22
- data/src/core/lib/surface/completion_queue_factory.cc +1 -1
- data/src/core/lib/surface/init.cc +1 -1
- data/src/core/lib/surface/init_secure.cc +2 -2
- data/src/core/lib/surface/lame_client.cc +10 -12
- data/src/core/lib/surface/server.cc +24 -18
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/byte_stream.cc +2 -2
- data/src/core/lib/transport/byte_stream.h +2 -1
- data/src/core/lib/transport/connectivity_state.cc +4 -4
- data/src/core/lib/transport/connectivity_state.h +2 -2
- data/src/core/lib/transport/metadata.cc +8 -10
- data/src/core/lib/transport/metadata.h +5 -8
- data/src/core/lib/transport/metadata_batch.cc +6 -0
- data/src/core/lib/transport/static_metadata.cc +2 -4
- data/src/core/lib/transport/status_metadata.cc +7 -0
- data/src/core/lib/transport/status_metadata.h +18 -0
- data/src/core/lib/transport/transport.cc +9 -7
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +292 -43
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +197 -46
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +4 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +5 -0
- data/src/core/tsi/ssl/session_cache/ssl_session.h +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +2 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -4
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +0 -6
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/upb/upb/decode.c +1 -0
- metadata +34 -32
- data/src/core/ext/filters/client_channel/connector.cc +0 -41
- data/src/core/ext/filters/client_channel/proxy_mapper.cc +0 -48
- data/src/core/lib/gprpp/set.h +0 -33
@@ -30,9 +30,11 @@
|
|
30
30
|
#include <grpc/support/sync.h>
|
31
31
|
#include <grpc/support/thd_id.h>
|
32
32
|
|
33
|
+
#include "src/core/lib/gprpp/sync.h"
|
33
34
|
#include "src/core/lib/gprpp/thd.h"
|
34
35
|
#include "src/core/lib/iomgr/closure.h"
|
35
36
|
#include "src/core/lib/slice/slice_internal.h"
|
37
|
+
#include "src/core/lib/surface/channel.h"
|
36
38
|
#include "src/core/tsi/alts/frame_protector/alts_frame_protector.h"
|
37
39
|
#include "src/core/tsi/alts/handshaker/alts_handshaker_client.h"
|
38
40
|
#include "src/core/tsi/alts/handshaker/alts_shared_resource.h"
|
@@ -42,7 +44,6 @@
|
|
42
44
|
/* Main struct for ALTS TSI handshaker. */
|
43
45
|
struct alts_tsi_handshaker {
|
44
46
|
tsi_handshaker base;
|
45
|
-
alts_handshaker_client* client;
|
46
47
|
grpc_slice target_name;
|
47
48
|
bool is_client;
|
48
49
|
bool has_sent_start_message;
|
@@ -52,6 +53,16 @@ struct alts_tsi_handshaker {
|
|
52
53
|
grpc_alts_credentials_options* options;
|
53
54
|
alts_handshaker_client_vtable* client_vtable_for_testing;
|
54
55
|
grpc_channel* channel;
|
56
|
+
bool use_dedicated_cq;
|
57
|
+
// mu synchronizes all fields below. Note these are the
|
58
|
+
// only fields that can be concurrently accessed (due to
|
59
|
+
// potential concurrency of tsi_handshaker_shutdown and
|
60
|
+
// tsi_handshaker_next).
|
61
|
+
gpr_mu mu;
|
62
|
+
alts_handshaker_client* client;
|
63
|
+
// shutdown effectively follows base.handshake_shutdown,
|
64
|
+
// but is synchronized by the mutex of this object.
|
65
|
+
bool shutdown;
|
55
66
|
};
|
56
67
|
|
57
68
|
/* Main struct for ALTS TSI handshaker result. */
|
@@ -63,6 +74,7 @@ typedef struct alts_tsi_handshaker_result {
|
|
63
74
|
size_t unused_bytes_size;
|
64
75
|
grpc_slice rpc_versions;
|
65
76
|
bool is_client;
|
77
|
+
grpc_slice serialized_context;
|
66
78
|
} alts_tsi_handshaker_result;
|
67
79
|
|
68
80
|
static tsi_result handshaker_result_extract_peer(
|
@@ -74,7 +86,7 @@ static tsi_result handshaker_result_extract_peer(
|
|
74
86
|
alts_tsi_handshaker_result* result =
|
75
87
|
reinterpret_cast<alts_tsi_handshaker_result*>(
|
76
88
|
const_cast<tsi_handshaker_result*>(self));
|
77
|
-
GPR_ASSERT(kTsiAltsNumOfPeerProperties ==
|
89
|
+
GPR_ASSERT(kTsiAltsNumOfPeerProperties == 4);
|
78
90
|
tsi_result ok = tsi_construct_peer(kTsiAltsNumOfPeerProperties, peer);
|
79
91
|
int index = 0;
|
80
92
|
if (ok != TSI_OK) {
|
@@ -104,7 +116,17 @@ static tsi_result handshaker_result_extract_peer(
|
|
104
116
|
ok = tsi_construct_string_peer_property(
|
105
117
|
TSI_ALTS_RPC_VERSIONS,
|
106
118
|
reinterpret_cast<char*>(GRPC_SLICE_START_PTR(result->rpc_versions)),
|
107
|
-
GRPC_SLICE_LENGTH(result->rpc_versions), &peer->properties[
|
119
|
+
GRPC_SLICE_LENGTH(result->rpc_versions), &peer->properties[index]);
|
120
|
+
if (ok != TSI_OK) {
|
121
|
+
tsi_peer_destruct(peer);
|
122
|
+
gpr_log(GPR_ERROR, "Failed to set tsi peer property");
|
123
|
+
}
|
124
|
+
index++;
|
125
|
+
GPR_ASSERT(&peer->properties[index] != nullptr);
|
126
|
+
ok = tsi_construct_string_peer_property(
|
127
|
+
TSI_ALTS_CONTEXT,
|
128
|
+
reinterpret_cast<char*>(GRPC_SLICE_START_PTR(result->serialized_context)),
|
129
|
+
GRPC_SLICE_LENGTH(result->serialized_context), &peer->properties[index]);
|
108
130
|
if (ok != TSI_OK) {
|
109
131
|
tsi_peer_destruct(peer);
|
110
132
|
gpr_log(GPR_ERROR, "Failed to set tsi peer property");
|
@@ -183,6 +205,7 @@ static void handshaker_result_destroy(tsi_handshaker_result* self) {
|
|
183
205
|
gpr_free(result->key_data);
|
184
206
|
gpr_free(result->unused_bytes);
|
185
207
|
grpc_slice_unref_internal(result->rpc_versions);
|
208
|
+
grpc_slice_unref_internal(result->serialized_context);
|
186
209
|
gpr_free(result);
|
187
210
|
}
|
188
211
|
|
@@ -207,9 +230,10 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp,
|
|
207
230
|
gpr_log(GPR_ERROR, "Invalid identity");
|
208
231
|
return TSI_FAILED_PRECONDITION;
|
209
232
|
}
|
210
|
-
upb_strview
|
211
|
-
|
212
|
-
|
233
|
+
upb_strview peer_service_account =
|
234
|
+
grpc_gcp_Identity_service_account(identity);
|
235
|
+
if (peer_service_account.size == 0) {
|
236
|
+
gpr_log(GPR_ERROR, "Invalid peer service account");
|
213
237
|
return TSI_FAILED_PRECONDITION;
|
214
238
|
}
|
215
239
|
upb_strview key_data = grpc_gcp_HandshakerResult_key_data(hresult);
|
@@ -223,21 +247,65 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp,
|
|
223
247
|
gpr_log(GPR_ERROR, "Peer does not set RPC protocol versions.");
|
224
248
|
return TSI_FAILED_PRECONDITION;
|
225
249
|
}
|
250
|
+
upb_strview application_protocol =
|
251
|
+
grpc_gcp_HandshakerResult_application_protocol(hresult);
|
252
|
+
if (application_protocol.size == 0) {
|
253
|
+
gpr_log(GPR_ERROR, "Invalid application protocol");
|
254
|
+
return TSI_FAILED_PRECONDITION;
|
255
|
+
}
|
256
|
+
upb_strview record_protocol =
|
257
|
+
grpc_gcp_HandshakerResult_record_protocol(hresult);
|
258
|
+
if (record_protocol.size == 0) {
|
259
|
+
gpr_log(GPR_ERROR, "Invalid record protocol");
|
260
|
+
return TSI_FAILED_PRECONDITION;
|
261
|
+
}
|
262
|
+
const grpc_gcp_Identity* local_identity =
|
263
|
+
grpc_gcp_HandshakerResult_local_identity(hresult);
|
264
|
+
if (local_identity == nullptr) {
|
265
|
+
gpr_log(GPR_ERROR, "Invalid local identity");
|
266
|
+
return TSI_FAILED_PRECONDITION;
|
267
|
+
}
|
268
|
+
upb_strview local_service_account =
|
269
|
+
grpc_gcp_Identity_service_account(local_identity);
|
270
|
+
// We don't check if local service account is empty here
|
271
|
+
// because local identity could be empty in certain situations.
|
226
272
|
alts_tsi_handshaker_result* result =
|
227
273
|
static_cast<alts_tsi_handshaker_result*>(gpr_zalloc(sizeof(*result)));
|
228
274
|
result->key_data =
|
229
275
|
static_cast<char*>(gpr_zalloc(kAltsAes128GcmRekeyKeyLength));
|
230
276
|
memcpy(result->key_data, key_data.data, kAltsAes128GcmRekeyKeyLength);
|
231
277
|
result->peer_identity =
|
232
|
-
static_cast<char*>(gpr_zalloc(
|
233
|
-
memcpy(result->peer_identity,
|
234
|
-
|
278
|
+
static_cast<char*>(gpr_zalloc(peer_service_account.size + 1));
|
279
|
+
memcpy(result->peer_identity, peer_service_account.data,
|
280
|
+
peer_service_account.size);
|
281
|
+
upb::Arena rpc_versions_arena;
|
235
282
|
bool serialized = grpc_gcp_rpc_protocol_versions_encode(
|
236
|
-
peer_rpc_version,
|
283
|
+
peer_rpc_version, rpc_versions_arena.ptr(), &result->rpc_versions);
|
237
284
|
if (!serialized) {
|
238
285
|
gpr_log(GPR_ERROR, "Failed to serialize peer's RPC protocol versions.");
|
239
286
|
return TSI_FAILED_PRECONDITION;
|
240
287
|
}
|
288
|
+
upb::Arena context_arena;
|
289
|
+
grpc_gcp_AltsContext* context = grpc_gcp_AltsContext_new(context_arena.ptr());
|
290
|
+
grpc_gcp_AltsContext_set_application_protocol(context, application_protocol);
|
291
|
+
grpc_gcp_AltsContext_set_record_protocol(context, record_protocol);
|
292
|
+
// ALTS currently only supports the security level of 2,
|
293
|
+
// which is "grpc_gcp_INTEGRITY_AND_PRIVACY".
|
294
|
+
grpc_gcp_AltsContext_set_security_level(context, 2);
|
295
|
+
grpc_gcp_AltsContext_set_peer_service_account(context, peer_service_account);
|
296
|
+
grpc_gcp_AltsContext_set_local_service_account(context,
|
297
|
+
local_service_account);
|
298
|
+
grpc_gcp_AltsContext_set_peer_rpc_versions(
|
299
|
+
context, const_cast<grpc_gcp_RpcProtocolVersions*>(peer_rpc_version));
|
300
|
+
size_t serialized_ctx_length;
|
301
|
+
char* serialized_ctx = grpc_gcp_AltsContext_serialize(
|
302
|
+
context, context_arena.ptr(), &serialized_ctx_length);
|
303
|
+
if (serialized_ctx == nullptr) {
|
304
|
+
gpr_log(GPR_ERROR, "Failed to serialize peer's ALTS context.");
|
305
|
+
return TSI_FAILED_PRECONDITION;
|
306
|
+
}
|
307
|
+
result->serialized_context =
|
308
|
+
grpc_slice_from_copied_buffer(serialized_ctx, serialized_ctx_length);
|
241
309
|
result->is_client = is_client;
|
242
310
|
result->base.vtable = &result_vtable;
|
243
311
|
*self = &result->base;
|
@@ -272,22 +340,11 @@ static void on_handshaker_service_resp_recv_dedicated(void* arg,
|
|
272
340
|
nullptr, &resource->storage);
|
273
341
|
}
|
274
342
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
size_t
|
279
|
-
|
280
|
-
if (self == nullptr || cb == nullptr) {
|
281
|
-
gpr_log(GPR_ERROR, "Invalid arguments to handshaker_next()");
|
282
|
-
return TSI_INVALID_ARGUMENT;
|
283
|
-
}
|
284
|
-
if (self->handshake_shutdown) {
|
285
|
-
gpr_log(GPR_ERROR, "TSI handshake shutdown");
|
286
|
-
return TSI_HANDSHAKE_SHUTDOWN;
|
287
|
-
}
|
288
|
-
alts_tsi_handshaker* handshaker =
|
289
|
-
reinterpret_cast<alts_tsi_handshaker*>(self);
|
290
|
-
tsi_result ok = TSI_OK;
|
343
|
+
/* Returns TSI_OK if and only if no error is encountered. */
|
344
|
+
static tsi_result alts_tsi_handshaker_continue_handshaker_next(
|
345
|
+
alts_tsi_handshaker* handshaker, const unsigned char* received_bytes,
|
346
|
+
size_t received_bytes_size, tsi_handshaker_on_next_done_cb cb,
|
347
|
+
void* user_data) {
|
291
348
|
if (!handshaker->has_created_handshaker_client) {
|
292
349
|
if (handshaker->channel == nullptr) {
|
293
350
|
grpc_alts_shared_resource_dedicated_start(
|
@@ -303,15 +360,24 @@ static tsi_result handshaker_next(
|
|
303
360
|
handshaker->channel == nullptr
|
304
361
|
? grpc_alts_get_shared_resource_dedicated()->channel
|
305
362
|
: handshaker->channel;
|
306
|
-
|
363
|
+
alts_handshaker_client* client = alts_grpc_handshaker_client_create(
|
307
364
|
handshaker, channel, handshaker->handshaker_service_url,
|
308
365
|
handshaker->interested_parties, handshaker->options,
|
309
366
|
handshaker->target_name, grpc_cb, cb, user_data,
|
310
367
|
handshaker->client_vtable_for_testing, handshaker->is_client);
|
311
|
-
if (
|
368
|
+
if (client == nullptr) {
|
312
369
|
gpr_log(GPR_ERROR, "Failed to create ALTS handshaker client");
|
313
370
|
return TSI_FAILED_PRECONDITION;
|
314
371
|
}
|
372
|
+
{
|
373
|
+
grpc_core::MutexLock lock(&handshaker->mu);
|
374
|
+
GPR_ASSERT(handshaker->client == nullptr);
|
375
|
+
handshaker->client = client;
|
376
|
+
if (handshaker->shutdown) {
|
377
|
+
gpr_log(GPR_ERROR, "TSI handshake shutdown");
|
378
|
+
return TSI_HANDSHAKE_SHUTDOWN;
|
379
|
+
}
|
380
|
+
}
|
315
381
|
handshaker->has_created_handshaker_client = true;
|
316
382
|
}
|
317
383
|
if (handshaker->channel == nullptr &&
|
@@ -324,18 +390,100 @@ static tsi_result handshaker_next(
|
|
324
390
|
: grpc_slice_from_copied_buffer(
|
325
391
|
reinterpret_cast<const char*>(received_bytes),
|
326
392
|
received_bytes_size);
|
393
|
+
tsi_result ok = TSI_OK;
|
327
394
|
if (!handshaker->has_sent_start_message) {
|
395
|
+
handshaker->has_sent_start_message = true;
|
328
396
|
ok = handshaker->is_client
|
329
397
|
? alts_handshaker_client_start_client(handshaker->client)
|
330
398
|
: alts_handshaker_client_start_server(handshaker->client, &slice);
|
331
|
-
|
399
|
+
// It's unsafe for the current thread to access any state in handshaker
|
400
|
+
// at this point, since alts_handshaker_client_start_client/server
|
401
|
+
// have potentially just started an op batch on the handshake call.
|
402
|
+
// The completion callback for that batch is unsynchronized and so
|
403
|
+
// can invoke the TSI next API callback from any thread, at which point
|
404
|
+
// there is nothing taking ownership of this handshaker to prevent it
|
405
|
+
// from being destroyed.
|
332
406
|
} else {
|
333
407
|
ok = alts_handshaker_client_next(handshaker->client, &slice);
|
334
408
|
}
|
335
409
|
grpc_slice_unref_internal(slice);
|
336
|
-
|
337
|
-
|
338
|
-
|
410
|
+
return ok;
|
411
|
+
}
|
412
|
+
|
413
|
+
struct alts_tsi_handshaker_continue_handshaker_next_args {
|
414
|
+
alts_tsi_handshaker* handshaker;
|
415
|
+
std::unique_ptr<unsigned char> received_bytes;
|
416
|
+
size_t received_bytes_size;
|
417
|
+
tsi_handshaker_on_next_done_cb cb;
|
418
|
+
void* user_data;
|
419
|
+
grpc_closure closure;
|
420
|
+
};
|
421
|
+
|
422
|
+
static void alts_tsi_handshaker_create_channel(void* arg,
|
423
|
+
grpc_error* unused_error) {
|
424
|
+
alts_tsi_handshaker_continue_handshaker_next_args* next_args =
|
425
|
+
static_cast<alts_tsi_handshaker_continue_handshaker_next_args*>(arg);
|
426
|
+
alts_tsi_handshaker* handshaker = next_args->handshaker;
|
427
|
+
GPR_ASSERT(handshaker->channel == nullptr);
|
428
|
+
handshaker->channel = grpc_insecure_channel_create(
|
429
|
+
next_args->handshaker->handshaker_service_url, nullptr, nullptr);
|
430
|
+
tsi_result continue_next_result =
|
431
|
+
alts_tsi_handshaker_continue_handshaker_next(
|
432
|
+
handshaker, next_args->received_bytes.get(),
|
433
|
+
next_args->received_bytes_size, next_args->cb, next_args->user_data);
|
434
|
+
if (continue_next_result != TSI_OK) {
|
435
|
+
next_args->cb(continue_next_result, next_args->user_data, nullptr, 0,
|
436
|
+
nullptr);
|
437
|
+
}
|
438
|
+
delete next_args;
|
439
|
+
}
|
440
|
+
|
441
|
+
static tsi_result handshaker_next(
|
442
|
+
tsi_handshaker* self, const unsigned char* received_bytes,
|
443
|
+
size_t received_bytes_size, const unsigned char** /*bytes_to_send*/,
|
444
|
+
size_t* /*bytes_to_send_size*/, tsi_handshaker_result** /*result*/,
|
445
|
+
tsi_handshaker_on_next_done_cb cb, void* user_data) {
|
446
|
+
if (self == nullptr || cb == nullptr) {
|
447
|
+
gpr_log(GPR_ERROR, "Invalid arguments to handshaker_next()");
|
448
|
+
return TSI_INVALID_ARGUMENT;
|
449
|
+
}
|
450
|
+
alts_tsi_handshaker* handshaker =
|
451
|
+
reinterpret_cast<alts_tsi_handshaker*>(self);
|
452
|
+
{
|
453
|
+
grpc_core::MutexLock lock(&handshaker->mu);
|
454
|
+
if (handshaker->shutdown) {
|
455
|
+
gpr_log(GPR_ERROR, "TSI handshake shutdown");
|
456
|
+
return TSI_HANDSHAKE_SHUTDOWN;
|
457
|
+
}
|
458
|
+
}
|
459
|
+
if (handshaker->channel == nullptr && !handshaker->use_dedicated_cq) {
|
460
|
+
alts_tsi_handshaker_continue_handshaker_next_args* args =
|
461
|
+
new alts_tsi_handshaker_continue_handshaker_next_args();
|
462
|
+
args->handshaker = handshaker;
|
463
|
+
args->received_bytes = nullptr;
|
464
|
+
args->received_bytes_size = received_bytes_size;
|
465
|
+
if (received_bytes_size > 0) {
|
466
|
+
args->received_bytes = std::unique_ptr<unsigned char>(
|
467
|
+
static_cast<unsigned char*>(gpr_zalloc(received_bytes_size)));
|
468
|
+
memcpy(args->received_bytes.get(), received_bytes, received_bytes_size);
|
469
|
+
}
|
470
|
+
args->cb = cb;
|
471
|
+
args->user_data = user_data;
|
472
|
+
GRPC_CLOSURE_INIT(&args->closure, alts_tsi_handshaker_create_channel, args,
|
473
|
+
grpc_schedule_on_exec_ctx);
|
474
|
+
// We continue this handshaker_next call at the bottom of the ExecCtx just
|
475
|
+
// so that we can invoke grpc_channel_create at the bottom of the call
|
476
|
+
// stack. Doing so avoids potential lock cycles between g_init_mu and other
|
477
|
+
// mutexes within core that might be held on the current call stack
|
478
|
+
// (note that g_init_mu gets acquired during channel creation).
|
479
|
+
grpc_core::ExecCtx::Run(DEBUG_LOCATION, &args->closure, GRPC_ERROR_NONE);
|
480
|
+
} else {
|
481
|
+
tsi_result ok = alts_tsi_handshaker_continue_handshaker_next(
|
482
|
+
handshaker, received_bytes, received_bytes_size, cb, user_data);
|
483
|
+
if (ok != TSI_OK) {
|
484
|
+
gpr_log(GPR_ERROR, "Failed to schedule ALTS handshaker requests");
|
485
|
+
return ok;
|
486
|
+
}
|
339
487
|
}
|
340
488
|
return TSI_ASYNC;
|
341
489
|
}
|
@@ -358,12 +506,16 @@ static tsi_result handshaker_next_dedicated(
|
|
358
506
|
|
359
507
|
static void handshaker_shutdown(tsi_handshaker* self) {
|
360
508
|
GPR_ASSERT(self != nullptr);
|
361
|
-
if (self->handshake_shutdown) {
|
362
|
-
return;
|
363
|
-
}
|
364
509
|
alts_tsi_handshaker* handshaker =
|
365
510
|
reinterpret_cast<alts_tsi_handshaker*>(self);
|
366
|
-
|
511
|
+
grpc_core::MutexLock lock(&handshaker->mu);
|
512
|
+
if (handshaker->shutdown) {
|
513
|
+
return;
|
514
|
+
}
|
515
|
+
if (handshaker->client != nullptr) {
|
516
|
+
alts_handshaker_client_shutdown(handshaker->client);
|
517
|
+
}
|
518
|
+
handshaker->shutdown = true;
|
367
519
|
}
|
368
520
|
|
369
521
|
static void handshaker_destroy(tsi_handshaker* self) {
|
@@ -376,9 +528,10 @@ static void handshaker_destroy(tsi_handshaker* self) {
|
|
376
528
|
grpc_slice_unref_internal(handshaker->target_name);
|
377
529
|
grpc_alts_credentials_options_destroy(handshaker->options);
|
378
530
|
if (handshaker->channel != nullptr) {
|
379
|
-
|
531
|
+
grpc_channel_destroy_internal(handshaker->channel);
|
380
532
|
}
|
381
533
|
gpr_free(handshaker->handshaker_service_url);
|
534
|
+
gpr_mu_destroy(&handshaker->mu);
|
382
535
|
gpr_free(handshaker);
|
383
536
|
}
|
384
537
|
|
@@ -400,7 +553,8 @@ static const tsi_handshaker_vtable handshaker_vtable_dedicated = {
|
|
400
553
|
|
401
554
|
bool alts_tsi_handshaker_has_shutdown(alts_tsi_handshaker* handshaker) {
|
402
555
|
GPR_ASSERT(handshaker != nullptr);
|
403
|
-
|
556
|
+
grpc_core::MutexLock lock(&handshaker->mu);
|
557
|
+
return handshaker->shutdown;
|
404
558
|
}
|
405
559
|
|
406
560
|
tsi_result alts_tsi_handshaker_create(
|
@@ -414,7 +568,8 @@ tsi_result alts_tsi_handshaker_create(
|
|
414
568
|
}
|
415
569
|
alts_tsi_handshaker* handshaker =
|
416
570
|
static_cast<alts_tsi_handshaker*>(gpr_zalloc(sizeof(*handshaker)));
|
417
|
-
|
571
|
+
gpr_mu_init(&handshaker->mu);
|
572
|
+
handshaker->use_dedicated_cq = interested_parties == nullptr;
|
418
573
|
handshaker->client = nullptr;
|
419
574
|
handshaker->is_client = is_client;
|
420
575
|
handshaker->has_sent_start_message = false;
|
@@ -425,13 +580,9 @@ tsi_result alts_tsi_handshaker_create(
|
|
425
580
|
handshaker->has_created_handshaker_client = false;
|
426
581
|
handshaker->handshaker_service_url = gpr_strdup(handshaker_service_url);
|
427
582
|
handshaker->options = grpc_alts_credentials_options_copy(options);
|
428
|
-
handshaker->base.vtable =
|
429
|
-
|
430
|
-
|
431
|
-
use_dedicated_cq
|
432
|
-
? nullptr
|
433
|
-
: grpc_insecure_channel_create(handshaker->handshaker_service_url,
|
434
|
-
nullptr, nullptr);
|
583
|
+
handshaker->base.vtable = handshaker->use_dedicated_cq
|
584
|
+
? &handshaker_vtable_dedicated
|
585
|
+
: &handshaker_vtable;
|
435
586
|
*self = &handshaker->base;
|
436
587
|
return TSI_OK;
|
437
588
|
}
|
@@ -28,13 +28,15 @@
|
|
28
28
|
#include "src/core/tsi/alts/handshaker/alts_handshaker_client.h"
|
29
29
|
#include "src/core/tsi/transport_security.h"
|
30
30
|
#include "src/core/tsi/transport_security_interface.h"
|
31
|
+
#include "src/proto/grpc/gcp/altscontext.upb.h"
|
31
32
|
#include "src/proto/grpc/gcp/handshaker.upb.h"
|
32
33
|
|
33
|
-
#define TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY "
|
34
|
+
#define TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY "service_account"
|
34
35
|
#define TSI_ALTS_CERTIFICATE_TYPE "ALTS"
|
35
36
|
#define TSI_ALTS_RPC_VERSIONS "rpc_versions"
|
37
|
+
#define TSI_ALTS_CONTEXT "alts_context"
|
36
38
|
|
37
|
-
const size_t kTsiAltsNumOfPeerProperties =
|
39
|
+
const size_t kTsiAltsNumOfPeerProperties = 4;
|
38
40
|
|
39
41
|
typedef struct alts_tsi_handshaker alts_tsi_handshaker;
|
40
42
|
|
@@ -77,6 +77,11 @@ void alts_handshaker_client_set_cb_for_testing(
|
|
77
77
|
grpc_closure* alts_handshaker_client_get_closure_for_testing(
|
78
78
|
alts_handshaker_client* client);
|
79
79
|
|
80
|
+
void alts_handshaker_client_on_status_received_for_testing(
|
81
|
+
alts_handshaker_client* client, grpc_status_code status, grpc_error* error);
|
82
|
+
|
83
|
+
void alts_handshaker_client_ref_for_testing(alts_handshaker_client* c);
|
84
|
+
|
80
85
|
} // namespace internal
|
81
86
|
} // namespace grpc_core
|
82
87
|
|
@@ -57,7 +57,7 @@ class SslCachedSession {
|
|
57
57
|
SslCachedSession& operator=(const SslCachedSession&) = delete;
|
58
58
|
|
59
59
|
/// Create single cached instance of \a session.
|
60
|
-
static
|
60
|
+
static std::unique_ptr<SslCachedSession> Create(SslSessionPtr session);
|
61
61
|
|
62
62
|
virtual ~SslCachedSession() = default;
|
63
63
|
|
@@ -47,7 +47,7 @@ class BoringSslCachedSession : public SslCachedSession {
|
|
47
47
|
|
48
48
|
} // namespace
|
49
49
|
|
50
|
-
|
50
|
+
std::unique_ptr<SslCachedSession> SslCachedSession::Create(
|
51
51
|
SslSessionPtr session) {
|
52
52
|
return grpc_core::MakeUnique<BoringSslCachedSession>(std::move(session));
|
53
53
|
}
|
@@ -76,7 +76,7 @@ class SslSessionLRUCache::Node {
|
|
76
76
|
friend class SslSessionLRUCache;
|
77
77
|
|
78
78
|
grpc_slice key_;
|
79
|
-
|
79
|
+
std::unique_ptr<SslCachedSession> session_;
|
80
80
|
|
81
81
|
Node* next_ = nullptr;
|
82
82
|
Node* prev_ = nullptr;
|
@@ -92,7 +92,7 @@ SslSessionLRUCache::~SslSessionLRUCache() {
|
|
92
92
|
Node* node = use_order_list_head_;
|
93
93
|
while (node) {
|
94
94
|
Node* next = node->next_;
|
95
|
-
|
95
|
+
delete node;
|
96
96
|
node = next;
|
97
97
|
}
|
98
98
|
grpc_avl_unref(entry_by_key_, nullptr);
|
@@ -127,7 +127,7 @@ void SslSessionLRUCache::Put(const char* key, SslSessionPtr session) {
|
|
127
127
|
return;
|
128
128
|
}
|
129
129
|
grpc_slice key_slice = grpc_slice_from_copied_string(key);
|
130
|
-
node =
|
130
|
+
node = new Node(key_slice, std::move(session));
|
131
131
|
PushFront(node);
|
132
132
|
entry_by_key_ = grpc_avl_add(entry_by_key_, node->AvlKey(), node, nullptr);
|
133
133
|
AssertInvariants();
|
@@ -137,7 +137,7 @@ void SslSessionLRUCache::Put(const char* key, SslSessionPtr session) {
|
|
137
137
|
Remove(node);
|
138
138
|
// Order matters, key is destroyed after deleting node.
|
139
139
|
entry_by_key_ = grpc_avl_remove(entry_by_key_, node->AvlKey(), nullptr);
|
140
|
-
|
140
|
+
delete node;
|
141
141
|
AssertInvariants();
|
142
142
|
}
|
143
143
|
}
|