grpc 0.14.1 → 0.15.0
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 +1398 -817
- data/include/grpc/compression.h +2 -1
- data/include/grpc/grpc.h +10 -1
- data/include/grpc/grpc_cronet.h +51 -0
- data/include/grpc/grpc_posix.h +70 -0
- data/include/grpc/impl/codegen/atm.h +2 -2
- data/include/grpc/impl/codegen/{atm_win32.h → atm_windows.h} +3 -3
- data/include/grpc/impl/codegen/compression_types.h +39 -5
- data/include/grpc/impl/codegen/connectivity_state.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +10 -0
- data/include/grpc/impl/codegen/log.h +2 -1
- data/include/grpc/impl/codegen/port_platform.h +30 -12
- data/include/grpc/impl/codegen/slice_buffer.h +2 -3
- data/include/grpc/impl/codegen/sync.h +2 -2
- data/include/grpc/impl/codegen/{sync_win32.h → sync_windows.h} +3 -3
- data/include/grpc/support/{sync_win32.h → atm_windows.h} +4 -4
- data/include/grpc/support/avl.h +5 -0
- data/include/grpc/support/{log_win32.h → log_windows.h} +3 -3
- data/include/grpc/support/string_util.h +2 -1
- data/include/grpc/support/{atm_win32.h → sync_windows.h} +4 -4
- data/src/core/ext/census/gen/census.pb.c +179 -0
- data/src/core/ext/census/gen/census.pb.h +294 -0
- data/src/core/ext/census/grpc_filter.c +11 -7
- data/src/core/ext/client_config/channel_connectivity.c +28 -14
- data/src/core/ext/client_config/client_channel.c +77 -53
- data/src/core/ext/client_config/connector.h +1 -1
- data/src/core/ext/client_config/lb_policy.c +9 -6
- data/src/core/ext/client_config/lb_policy.h +9 -5
- data/src/core/ext/client_config/subchannel.c +58 -39
- data/src/core/ext/client_config/subchannel.h +3 -2
- data/src/core/ext/client_config/subchannel_call_holder.c +34 -19
- data/src/core/ext/client_config/subchannel_call_holder.h +2 -1
- data/src/core/ext/client_config/subchannel_index.c +20 -9
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +7 -7
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.h +5 -5
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/{v0 → v1}/load_balancer.pb.c +29 -30
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +178 -0
- data/src/core/ext/lb_policy/pick_first/pick_first.c +65 -45
- data/src/core/ext/lb_policy/round_robin/round_robin.c +84 -43
- data/src/core/ext/load_reporting/load_reporting.c +133 -0
- data/src/core/ext/load_reporting/load_reporting.h +75 -0
- data/src/core/ext/load_reporting/load_reporting_filter.c +151 -0
- data/src/core/ext/load_reporting/load_reporting_filter.h +41 -0
- data/src/core/ext/resolver/dns/native/dns_resolver.c +22 -8
- data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +2 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +4 -4
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +95 -0
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +14 -18
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +49 -24
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +82 -0
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +104 -60
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +232 -0
- data/src/{ruby/ext/grpc/rb_signal.c → core/ext/transport/chttp2/transport/bin_decoder.h} +27 -31
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +481 -260
- data/src/core/ext/transport/chttp2/transport/frame.h +1 -7
- data/src/core/ext/transport/chttp2/transport/frame_data.c +44 -27
- data/src/core/ext/transport/chttp2/transport/frame_data.h +6 -5
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +23 -17
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +12 -7
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -3
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +25 -12
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +23 -21
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +17 -9
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +365 -287
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +8 -6
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +24 -20
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -4
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +1 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +1 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +34 -32
- data/src/core/ext/transport/chttp2/transport/parsing.c +296 -212
- data/src/core/ext/transport/chttp2/transport/writing.c +12 -9
- data/src/core/lib/channel/channel_args.c +26 -12
- data/src/core/lib/channel/channel_args.h +1 -1
- data/src/core/lib/channel/channel_stack.c +12 -8
- data/src/core/lib/channel/channel_stack.h +27 -11
- data/src/core/lib/channel/channel_stack_builder.c +2 -2
- data/src/core/lib/channel/compress_filter.c +26 -31
- data/src/core/lib/channel/compress_filter.h +4 -4
- data/src/core/lib/channel/connected_channel.c +7 -5
- data/src/core/lib/channel/http_client_filter.c +34 -8
- data/src/core/lib/channel/http_client_filter.h +1 -1
- data/src/core/lib/channel/http_server_filter.c +21 -12
- data/src/core/lib/compression/{compression_algorithm.c → compression.c} +22 -21
- data/src/core/lib/http/httpcli.c +81 -59
- data/src/core/lib/http/httpcli.h +11 -15
- data/src/core/lib/http/httpcli_security_connector.c +5 -3
- data/src/core/lib/http/parser.c +127 -118
- data/src/core/lib/http/parser.h +11 -6
- data/src/core/lib/iomgr/closure.c +20 -16
- data/src/core/lib/iomgr/closure.h +19 -15
- data/src/core/lib/iomgr/endpoint.h +1 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.c +2 -2
- data/src/core/lib/iomgr/error.c +535 -0
- data/src/core/lib/iomgr/error.h +192 -0
- data/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +190 -83
- data/src/core/lib/iomgr/ev_poll_posix.c +1267 -0
- data/src/{ruby/ext/grpc/rb_signal.h → core/lib/iomgr/ev_poll_posix.h} +7 -5
- data/src/core/lib/iomgr/ev_posix.c +104 -14
- data/src/core/lib/iomgr/ev_posix.h +17 -7
- data/src/core/lib/iomgr/exec_ctx.c +25 -7
- data/src/core/lib/iomgr/exec_ctx.h +27 -8
- data/src/core/lib/iomgr/executor.c +2 -2
- data/src/core/lib/iomgr/executor.h +1 -1
- data/src/core/lib/iomgr/iocp_windows.c +2 -41
- data/src/core/lib/iomgr/iocp_windows.h +0 -8
- data/src/core/lib/iomgr/iomgr.c +5 -4
- data/src/core/lib/iomgr/iomgr_posix.c +5 -1
- data/src/core/lib/iomgr/iomgr_windows.c +1 -1
- data/src/core/lib/{support → iomgr}/load_file.c +15 -17
- data/src/core/lib/{support → iomgr}/load_file.h +8 -7
- data/src/core/lib/iomgr/polling_entity.c +104 -0
- data/src/core/lib/iomgr/polling_entity.h +81 -0
- data/src/core/lib/iomgr/pollset.h +6 -5
- data/src/core/lib/iomgr/pollset_set_windows.c +4 -1
- data/src/core/lib/iomgr/pollset_windows.c +10 -6
- data/src/core/lib/iomgr/resolve_address.h +5 -9
- data/src/core/lib/iomgr/resolve_address_posix.c +55 -38
- data/src/core/lib/iomgr/resolve_address_windows.c +51 -37
- data/src/core/lib/iomgr/sockaddr.h +2 -2
- data/src/core/lib/iomgr/{sockaddr_win32.h → sockaddr_windows.h} +3 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.c +92 -45
- data/src/core/lib/iomgr/socket_utils_posix.h +19 -12
- data/src/core/lib/iomgr/socket_windows.c +61 -2
- data/src/core/lib/iomgr/socket_windows.h +13 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +54 -39
- data/src/core/lib/iomgr/tcp_client_windows.c +34 -34
- data/src/core/lib/iomgr/tcp_posix.c +43 -39
- data/src/core/lib/iomgr/tcp_server.h +5 -3
- data/src/core/lib/iomgr/tcp_server_posix.c +103 -64
- data/src/core/lib/iomgr/tcp_server_windows.c +114 -101
- data/src/core/lib/iomgr/tcp_windows.c +45 -50
- data/src/core/lib/iomgr/tcp_windows.h +1 -1
- data/src/core/lib/iomgr/timer.c +26 -13
- data/src/core/lib/iomgr/udp_server.c +28 -4
- data/src/core/lib/iomgr/udp_server.h +5 -1
- data/src/core/lib/iomgr/unix_sockets_posix.c +8 -7
- data/src/core/lib/iomgr/unix_sockets_posix.h +2 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +4 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.c +15 -5
- data/src/core/lib/iomgr/wakeup_fd_pipe.c +13 -9
- data/src/core/lib/iomgr/wakeup_fd_posix.c +6 -6
- data/src/core/lib/iomgr/wakeup_fd_posix.h +9 -6
- data/src/core/lib/iomgr/workqueue.h +5 -4
- data/src/core/lib/iomgr/workqueue_posix.c +40 -26
- data/src/core/lib/iomgr/workqueue_windows.c +2 -2
- data/src/core/lib/profiling/basic_timers.c +2 -2
- data/src/core/lib/security/{security_context.c → context/security_context.c} +1 -1
- data/src/core/lib/security/{security_context.h → context/security_context.h} +4 -4
- data/src/core/lib/security/credentials/composite/composite_credentials.c +263 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.h +72 -0
- data/src/core/lib/security/credentials/credentials.c +233 -0
- data/src/core/lib/security/{credentials.h → credentials/credentials.h} +19 -157
- data/src/core/lib/security/{credentials_metadata.c → credentials/credentials_metadata.c} +1 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +139 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +56 -0
- data/src/core/lib/security/{credentials_posix.c → credentials/google_default/credentials_posix.c} +1 -1
- data/src/core/lib/security/{credentials_win32.c → credentials/google_default/credentials_windows.c} +3 -3
- data/src/core/lib/security/{google_default_credentials.c → credentials/google_default/google_default_credentials.c} +93 -35
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +46 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.c +85 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.h +44 -0
- data/src/core/lib/security/{json_token.c → credentials/jwt/json_token.c} +10 -101
- data/src/core/lib/security/{json_token.h → credentials/jwt/json_token.h} +3 -33
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +160 -0
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +62 -0
- data/src/core/lib/security/{jwt_verifier.c → credentials/jwt/jwt_verifier.c} +35 -15
- data/src/core/lib/security/{jwt_verifier.h → credentials/jwt/jwt_verifier.h} +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +433 -0
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +109 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +129 -0
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +45 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +240 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +48 -0
- data/src/core/lib/security/{auth_filters.h → transport/auth_filters.h} +3 -3
- data/src/core/lib/security/{client_auth_filter.c → transport/client_auth_filter.c} +27 -20
- data/src/core/lib/security/{handshake.c → transport/handshake.c} +77 -45
- data/src/core/lib/security/{handshake.h → transport/handshake.h} +9 -11
- data/src/core/lib/security/{secure_endpoint.c → transport/secure_endpoint.c} +19 -12
- data/src/core/lib/security/{secure_endpoint.h → transport/secure_endpoint.h} +3 -3
- data/src/core/lib/security/{security_connector.c → transport/security_connector.c} +26 -17
- data/src/core/lib/security/{security_connector.h → transport/security_connector.h} +8 -8
- data/src/core/lib/security/{server_auth_filter.c → transport/server_auth_filter.c} +24 -16
- data/src/core/lib/security/transport/tsi_error.c +40 -0
- data/src/core/lib/security/transport/tsi_error.h +42 -0
- data/src/core/lib/security/{b64.c → util/b64.c} +1 -1
- data/src/core/lib/security/{b64.h → util/b64.h} +3 -3
- data/src/core/lib/security/util/json_util.c +61 -0
- data/src/core/lib/security/util/json_util.h +55 -0
- data/src/core/lib/support/avl.c +11 -0
- data/src/core/lib/support/cpu_windows.c +2 -2
- data/src/core/lib/support/{env_win32.c → env_windows.c} +3 -3
- data/src/core/lib/support/log.c +3 -1
- data/src/core/lib/support/log_linux.c +2 -2
- data/src/core/lib/support/{log_win32.c → log_windows.c} +4 -4
- data/src/core/lib/support/murmur_hash.c +3 -5
- data/src/core/lib/support/string.c +10 -0
- data/src/core/lib/support/string.h +4 -0
- data/src/core/lib/support/{string_util_win32.c → string_util_windows.c} +3 -3
- data/src/core/lib/support/{string_win32.c → string_windows.c} +2 -2
- data/src/core/lib/support/{string_win32.h → string_windows.h} +5 -5
- data/src/core/lib/support/subprocess_windows.c +1 -1
- data/src/core/lib/support/{sync_win32.c → sync_windows.c} +2 -2
- data/src/core/lib/support/{thd_win32.c → thd_windows.c} +2 -2
- data/src/core/lib/support/{time_win32.c → time_windows.c} +2 -2
- data/src/core/lib/support/tmpfile_msys.c +1 -1
- data/src/core/lib/support/{tmpfile_win32.c → tmpfile_windows.c} +3 -3
- data/src/core/lib/surface/alarm.c +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +13 -6
- data/src/core/lib/surface/call.c +323 -123
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/call_log_batch.c +1 -1
- data/src/core/lib/surface/channel.c +64 -15
- data/src/core/lib/surface/channel.h +9 -0
- data/src/core/lib/surface/channel_ping.c +3 -3
- data/src/core/lib/surface/completion_queue.c +75 -19
- data/src/core/lib/surface/completion_queue.h +7 -2
- data/src/core/lib/surface/init.c +2 -1
- data/src/core/lib/surface/init_secure.c +4 -4
- data/src/core/lib/surface/lame_client.c +12 -8
- data/src/core/lib/surface/server.c +213 -120
- data/src/core/lib/surface/server.h +1 -0
- data/src/core/lib/surface/version.c +1 -1
- data/src/core/lib/transport/connectivity_state.c +40 -18
- data/src/core/lib/transport/connectivity_state.h +4 -1
- data/src/core/lib/transport/metadata.c +23 -23
- data/src/core/lib/transport/metadata.h +4 -0
- data/src/core/lib/transport/metadata_batch.c +9 -0
- data/src/core/lib/transport/metadata_batch.h +3 -0
- data/src/core/lib/transport/static_metadata.c +6 -5
- data/src/core/lib/transport/static_metadata.h +64 -60
- data/src/core/lib/transport/transport.c +24 -12
- data/src/core/lib/transport/transport.h +6 -5
- data/src/core/lib/transport/transport_impl.h +4 -0
- data/src/core/lib/transport/transport_op_string.c +2 -2
- data/src/core/plugin_registry/grpc_plugin_registry.c +4 -0
- data/src/ruby/bin/math_services.rb +41 -2
- data/src/ruby/ext/grpc/rb_call.c +42 -40
- data/src/ruby/ext/grpc/rb_channel.c +1 -1
- data/src/ruby/ext/grpc/rb_completion_queue.c +59 -6
- data/src/ruby/ext/grpc/rb_completion_queue.h +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +1 -3
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +21 -5
- data/src/ruby/ext/grpc/rb_loader.c +1 -1
- data/src/ruby/ext/grpc/rb_server.c +5 -3
- data/src/ruby/lib/grpc.rb +0 -3
- data/src/ruby/lib/grpc/errors.rb +3 -2
- data/src/ruby/lib/grpc/generic/active_call.rb +32 -42
- data/src/ruby/lib/grpc/generic/bidi_call.rb +20 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +31 -54
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +4 -4
- data/src/ruby/lib/grpc/generic/rpc_server.rb +12 -23
- data/src/ruby/lib/grpc/generic/service.rb +8 -8
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_services.rb +30 -2
- data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services.rb +34 -4
- data/src/ruby/pb/grpc/testing/metrics_services.rb +39 -2
- data/src/ruby/pb/src/proto/grpc/testing/empty.rb +15 -0
- data/src/ruby/pb/src/proto/grpc/testing/messages.rb +84 -0
- data/src/ruby/pb/src/proto/grpc/testing/test.rb +14 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services.rb +110 -0
- data/src/ruby/pb/test/client.rb +5 -2
- data/src/ruby/spec/generic/active_call_spec.rb +3 -2
- data/src/ruby/spec/generic/client_stub_spec.rb +27 -24
- data/src/ruby/spec/generic/rpc_desc_spec.rb +11 -11
- data/src/ruby/spec/generic/rpc_server_spec.rb +42 -61
- data/src/ruby/spec/pb/health/checker_spec.rb +3 -5
- metadata +86 -48
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h +0 -182
- data/src/core/lib/security/credentials.c +0 -1296
- data/src/ruby/lib/grpc/signals.rb +0 -69
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2016, Google Inc.
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are
|
8
|
+
* met:
|
9
|
+
*
|
10
|
+
* * Redistributions of source code must retain the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
12
|
+
* * Redistributions in binary form must reproduce the above
|
13
|
+
* copyright notice, this list of conditions and the following disclaimer
|
14
|
+
* in the documentation and/or other materials provided with the
|
15
|
+
* distribution.
|
16
|
+
* * Neither the name of Google Inc. nor the names of its
|
17
|
+
* contributors may be used to endorse or promote products derived from
|
18
|
+
* this software without specific prior written permission.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
|
34
|
+
#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H
|
35
|
+
|
36
|
+
#include "src/core/lib/security/credentials/credentials.h"
|
37
|
+
|
38
|
+
typedef struct {
|
39
|
+
grpc_channel_credentials base;
|
40
|
+
grpc_ssl_config config;
|
41
|
+
} grpc_ssl_credentials;
|
42
|
+
|
43
|
+
typedef struct {
|
44
|
+
grpc_server_credentials base;
|
45
|
+
grpc_ssl_server_config config;
|
46
|
+
} grpc_ssl_server_credentials;
|
47
|
+
|
48
|
+
#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_SSL_SSL_CREDENTIALS_H */
|
@@ -31,12 +31,12 @@
|
|
31
31
|
*
|
32
32
|
*/
|
33
33
|
|
34
|
-
#ifndef
|
35
|
-
#define
|
34
|
+
#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
|
35
|
+
#define GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H
|
36
36
|
|
37
37
|
#include "src/core/lib/channel/channel_stack.h"
|
38
38
|
|
39
39
|
extern const grpc_channel_filter grpc_client_auth_filter;
|
40
40
|
extern const grpc_channel_filter grpc_server_auth_filter;
|
41
41
|
|
42
|
-
#endif /*
|
42
|
+
#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_AUTH_FILTERS_H */
|
@@ -31,7 +31,7 @@
|
|
31
31
|
*
|
32
32
|
*/
|
33
33
|
|
34
|
-
#include "src/core/lib/security/auth_filters.h"
|
34
|
+
#include "src/core/lib/security/transport/auth_filters.h"
|
35
35
|
|
36
36
|
#include <string.h>
|
37
37
|
|
@@ -40,9 +40,9 @@
|
|
40
40
|
#include <grpc/support/string_util.h>
|
41
41
|
|
42
42
|
#include "src/core/lib/channel/channel_stack.h"
|
43
|
-
#include "src/core/lib/security/
|
44
|
-
#include "src/core/lib/security/
|
45
|
-
#include "src/core/lib/security/
|
43
|
+
#include "src/core/lib/security/context/security_context.h"
|
44
|
+
#include "src/core/lib/security/credentials/credentials.h"
|
45
|
+
#include "src/core/lib/security/transport/security_connector.h"
|
46
46
|
#include "src/core/lib/support/string.h"
|
47
47
|
#include "src/core/lib/surface/call.h"
|
48
48
|
#include "src/core/lib/transport/static_metadata.h"
|
@@ -54,11 +54,11 @@ typedef struct {
|
|
54
54
|
grpc_call_credentials *creds;
|
55
55
|
grpc_mdstr *host;
|
56
56
|
grpc_mdstr *method;
|
57
|
-
/* pollset bound to this call; if we need to make external
|
58
|
-
network requests, they should be done under
|
59
|
-
so that work can progress when this call wants work to
|
60
|
-
|
61
|
-
|
57
|
+
/* pollset{_set} bound to this call; if we need to make external
|
58
|
+
network requests, they should be done under a pollset added to this
|
59
|
+
pollset_set so that work can progress when this call wants work to progress
|
60
|
+
*/
|
61
|
+
grpc_polling_entity *pollent;
|
62
62
|
grpc_transport_stream_op op;
|
63
63
|
uint8_t security_context_set;
|
64
64
|
grpc_linked_mdelem md_links[MAX_CREDENTIALS_METADATA_COUNT];
|
@@ -184,9 +184,9 @@ static void send_security_metadata(grpc_exec_ctx *exec_ctx,
|
|
184
184
|
build_auth_metadata_context(&chand->security_connector->base,
|
185
185
|
chand->auth_context, calld);
|
186
186
|
calld->op = *op; /* Copy op (originates from the caller's stack). */
|
187
|
-
GPR_ASSERT(calld->
|
187
|
+
GPR_ASSERT(calld->pollent != NULL);
|
188
188
|
grpc_call_credentials_get_request_metadata(
|
189
|
-
exec_ctx, calld->creds, calld->
|
189
|
+
exec_ctx, calld->creds, calld->pollent, calld->auth_md_context,
|
190
190
|
on_credentials_metadata, elem);
|
191
191
|
}
|
192
192
|
|
@@ -270,15 +270,16 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
|
270
270
|
memset(calld, 0, sizeof(*calld));
|
271
271
|
}
|
272
272
|
|
273
|
-
static void
|
274
|
-
|
273
|
+
static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
|
274
|
+
grpc_call_element *elem,
|
275
|
+
grpc_polling_entity *pollent) {
|
275
276
|
call_data *calld = elem->call_data;
|
276
|
-
calld->
|
277
|
+
calld->pollent = pollent;
|
277
278
|
}
|
278
279
|
|
279
280
|
/* Destructor for call_data */
|
280
281
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
281
|
-
void *ignored) {
|
282
|
+
const grpc_call_stats *stats, void *ignored) {
|
282
283
|
call_data *calld = elem->call_data;
|
283
284
|
grpc_call_credentials_unref(calld->creds);
|
284
285
|
if (calld->host != NULL) {
|
@@ -329,8 +330,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
329
330
|
GRPC_AUTH_CONTEXT_UNREF(chand->auth_context, "client_auth_filter");
|
330
331
|
}
|
331
332
|
|
332
|
-
const grpc_channel_filter grpc_client_auth_filter = {
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
333
|
+
const grpc_channel_filter grpc_client_auth_filter = {auth_start_transport_op,
|
334
|
+
grpc_channel_next_op,
|
335
|
+
sizeof(call_data),
|
336
|
+
init_call_elem,
|
337
|
+
set_pollset_or_pollset_set,
|
338
|
+
destroy_call_elem,
|
339
|
+
sizeof(channel_data),
|
340
|
+
init_channel_elem,
|
341
|
+
destroy_channel_elem,
|
342
|
+
grpc_call_next_get_peer,
|
343
|
+
"client-auth"};
|
@@ -31,7 +31,7 @@
|
|
31
31
|
*
|
32
32
|
*/
|
33
33
|
|
34
|
-
#include "src/core/lib/security/handshake.h"
|
34
|
+
#include "src/core/lib/security/transport/handshake.h"
|
35
35
|
|
36
36
|
#include <stdbool.h>
|
37
37
|
#include <string.h>
|
@@ -39,8 +39,10 @@
|
|
39
39
|
#include <grpc/support/alloc.h>
|
40
40
|
#include <grpc/support/log.h>
|
41
41
|
#include <grpc/support/slice_buffer.h>
|
42
|
-
#include "src/core/lib/
|
43
|
-
#include "src/core/lib/security/security_context.h"
|
42
|
+
#include "src/core/lib/iomgr/timer.h"
|
43
|
+
#include "src/core/lib/security/context/security_context.h"
|
44
|
+
#include "src/core/lib/security/transport/secure_endpoint.h"
|
45
|
+
#include "src/core/lib/security/transport/tsi_error.h"
|
44
46
|
|
45
47
|
#define GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE 256
|
46
48
|
|
@@ -60,13 +62,16 @@ typedef struct {
|
|
60
62
|
grpc_closure on_handshake_data_sent_to_peer;
|
61
63
|
grpc_closure on_handshake_data_received_from_peer;
|
62
64
|
grpc_auth_context *auth_context;
|
65
|
+
grpc_timer timer;
|
66
|
+
gpr_refcount refs;
|
63
67
|
} grpc_security_handshake;
|
64
68
|
|
65
69
|
static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
|
66
|
-
void *setup,
|
70
|
+
void *setup,
|
71
|
+
grpc_error *error);
|
67
72
|
|
68
73
|
static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx, void *setup,
|
69
|
-
|
74
|
+
grpc_error *error);
|
70
75
|
|
71
76
|
static void security_connector_remove_handshake(grpc_security_handshake *h) {
|
72
77
|
GPR_ASSERT(!h->is_client_side);
|
@@ -95,16 +100,34 @@ static void security_connector_remove_handshake(grpc_security_handshake *h) {
|
|
95
100
|
gpr_mu_unlock(&sc->mu);
|
96
101
|
}
|
97
102
|
|
103
|
+
static void unref_handshake(grpc_security_handshake *h) {
|
104
|
+
if (gpr_unref(&h->refs)) {
|
105
|
+
if (h->handshaker != NULL) tsi_handshaker_destroy(h->handshaker);
|
106
|
+
if (h->handshake_buffer != NULL) gpr_free(h->handshake_buffer);
|
107
|
+
gpr_slice_buffer_destroy(&h->left_overs);
|
108
|
+
gpr_slice_buffer_destroy(&h->outgoing);
|
109
|
+
gpr_slice_buffer_destroy(&h->incoming);
|
110
|
+
GRPC_AUTH_CONTEXT_UNREF(h->auth_context, "handshake");
|
111
|
+
GRPC_SECURITY_CONNECTOR_UNREF(h->connector, "handshake");
|
112
|
+
gpr_free(h);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
98
116
|
static void security_handshake_done(grpc_exec_ctx *exec_ctx,
|
99
117
|
grpc_security_handshake *h,
|
100
|
-
|
118
|
+
grpc_error *error) {
|
119
|
+
grpc_timer_cancel(exec_ctx, &h->timer);
|
101
120
|
if (!h->is_client_side) {
|
102
121
|
security_connector_remove_handshake(h);
|
103
122
|
}
|
104
|
-
if (
|
123
|
+
if (error == GRPC_ERROR_NONE) {
|
105
124
|
h->cb(exec_ctx, h->user_data, GRPC_SECURITY_OK, h->secure_endpoint,
|
106
125
|
h->auth_context);
|
107
126
|
} else {
|
127
|
+
const char *msg = grpc_error_string(error);
|
128
|
+
gpr_log(GPR_ERROR, "Security handshake failed: %s", msg);
|
129
|
+
grpc_error_free_string(msg);
|
130
|
+
|
108
131
|
if (h->secure_endpoint != NULL) {
|
109
132
|
grpc_endpoint_shutdown(exec_ctx, h->secure_endpoint);
|
110
133
|
grpc_endpoint_destroy(exec_ctx, h->secure_endpoint);
|
@@ -113,14 +136,8 @@ static void security_handshake_done(grpc_exec_ctx *exec_ctx,
|
|
113
136
|
}
|
114
137
|
h->cb(exec_ctx, h->user_data, GRPC_SECURITY_ERROR, NULL, NULL);
|
115
138
|
}
|
116
|
-
|
117
|
-
|
118
|
-
gpr_slice_buffer_destroy(&h->left_overs);
|
119
|
-
gpr_slice_buffer_destroy(&h->outgoing);
|
120
|
-
gpr_slice_buffer_destroy(&h->incoming);
|
121
|
-
GRPC_AUTH_CONTEXT_UNREF(h->auth_context, "handshake");
|
122
|
-
GRPC_SECURITY_CONNECTOR_UNREF(h->connector, "handshake");
|
123
|
-
gpr_free(h);
|
139
|
+
unref_handshake(h);
|
140
|
+
GRPC_ERROR_UNREF(error);
|
124
141
|
}
|
125
142
|
|
126
143
|
static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *user_data,
|
@@ -130,17 +147,20 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *user_data,
|
|
130
147
|
tsi_frame_protector *protector;
|
131
148
|
tsi_result result;
|
132
149
|
if (status != GRPC_SECURITY_OK) {
|
133
|
-
|
134
|
-
|
150
|
+
security_handshake_done(
|
151
|
+
exec_ctx, h,
|
152
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("Error checking peer."),
|
153
|
+
GRPC_ERROR_INT_SECURITY_STATUS, status));
|
135
154
|
return;
|
136
155
|
}
|
137
156
|
h->auth_context = GRPC_AUTH_CONTEXT_REF(auth_context, "handshake");
|
138
157
|
result =
|
139
158
|
tsi_handshaker_create_frame_protector(h->handshaker, NULL, &protector);
|
140
159
|
if (result != TSI_OK) {
|
141
|
-
|
142
|
-
|
143
|
-
|
160
|
+
security_handshake_done(
|
161
|
+
exec_ctx, h,
|
162
|
+
grpc_set_tsi_error_result(
|
163
|
+
GRPC_ERROR_CREATE("Frame protector creation failed"), result));
|
144
164
|
return;
|
145
165
|
}
|
146
166
|
h->secure_endpoint =
|
@@ -148,7 +168,7 @@ static void on_peer_checked(grpc_exec_ctx *exec_ctx, void *user_data,
|
|
148
168
|
h->left_overs.slices, h->left_overs.count);
|
149
169
|
h->left_overs.count = 0;
|
150
170
|
h->left_overs.length = 0;
|
151
|
-
security_handshake_done(exec_ctx, h,
|
171
|
+
security_handshake_done(exec_ctx, h, GRPC_ERROR_NONE);
|
152
172
|
return;
|
153
173
|
}
|
154
174
|
|
@@ -157,9 +177,9 @@ static void check_peer(grpc_exec_ctx *exec_ctx, grpc_security_handshake *h) {
|
|
157
177
|
tsi_result result = tsi_handshaker_extract_peer(h->handshaker, &peer);
|
158
178
|
|
159
179
|
if (result != TSI_OK) {
|
160
|
-
|
161
|
-
|
162
|
-
|
180
|
+
security_handshake_done(
|
181
|
+
exec_ctx, h, grpc_set_tsi_error_result(
|
182
|
+
GRPC_ERROR_CREATE("Peer extraction failed"), result));
|
163
183
|
return;
|
164
184
|
}
|
165
185
|
grpc_security_connector_check_peer(exec_ctx, h->connector, peer,
|
@@ -185,9 +205,9 @@ static void send_handshake_bytes_to_peer(grpc_exec_ctx *exec_ctx,
|
|
185
205
|
} while (result == TSI_INCOMPLETE_DATA);
|
186
206
|
|
187
207
|
if (result != TSI_OK) {
|
188
|
-
|
189
|
-
|
190
|
-
|
208
|
+
security_handshake_done(exec_ctx, h,
|
209
|
+
grpc_set_tsi_error_result(
|
210
|
+
GRPC_ERROR_CREATE("Handshake failed"), result));
|
191
211
|
return;
|
192
212
|
}
|
193
213
|
|
@@ -203,7 +223,7 @@ static void send_handshake_bytes_to_peer(grpc_exec_ctx *exec_ctx,
|
|
203
223
|
|
204
224
|
static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
|
205
225
|
void *handshake,
|
206
|
-
|
226
|
+
grpc_error *error) {
|
207
227
|
grpc_security_handshake *h = handshake;
|
208
228
|
size_t consumed_slice_size = 0;
|
209
229
|
tsi_result result = TSI_OK;
|
@@ -211,9 +231,10 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
|
|
211
231
|
size_t num_left_overs;
|
212
232
|
int has_left_overs_in_current_slice = 0;
|
213
233
|
|
214
|
-
if (
|
215
|
-
|
216
|
-
|
234
|
+
if (error != GRPC_ERROR_NONE) {
|
235
|
+
security_handshake_done(
|
236
|
+
exec_ctx, h,
|
237
|
+
GRPC_ERROR_CREATE_REFERENCING("Handshake read failed", &error, 1));
|
217
238
|
return;
|
218
239
|
}
|
219
240
|
|
@@ -238,9 +259,9 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
|
|
238
259
|
}
|
239
260
|
|
240
261
|
if (result != TSI_OK) {
|
241
|
-
|
242
|
-
|
243
|
-
|
262
|
+
security_handshake_done(exec_ctx, h,
|
263
|
+
grpc_set_tsi_error_result(
|
264
|
+
GRPC_ERROR_CREATE("Handshake failed"), result));
|
244
265
|
return;
|
245
266
|
}
|
246
267
|
|
@@ -270,13 +291,15 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
|
|
270
291
|
|
271
292
|
/* If handshake is NULL, the handshake is done. */
|
272
293
|
static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx,
|
273
|
-
void *handshake,
|
294
|
+
void *handshake, grpc_error *error) {
|
274
295
|
grpc_security_handshake *h = handshake;
|
275
296
|
|
276
297
|
/* Make sure that write is OK. */
|
277
|
-
if (
|
278
|
-
|
279
|
-
|
298
|
+
if (error != GRPC_ERROR_NONE) {
|
299
|
+
if (handshake != NULL)
|
300
|
+
security_handshake_done(
|
301
|
+
exec_ctx, h,
|
302
|
+
GRPC_ERROR_CREATE_REFERENCING("Handshake write failed", &error, 1));
|
280
303
|
return;
|
281
304
|
}
|
282
305
|
|
@@ -291,13 +314,19 @@ static void on_handshake_data_sent_to_peer(grpc_exec_ctx *exec_ctx,
|
|
291
314
|
}
|
292
315
|
}
|
293
316
|
|
294
|
-
void
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
317
|
+
static void on_timeout(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
318
|
+
grpc_security_handshake *h = arg;
|
319
|
+
if (error == GRPC_ERROR_NONE) {
|
320
|
+
grpc_endpoint_shutdown(exec_ctx, h->wrapped_endpoint);
|
321
|
+
}
|
322
|
+
unref_handshake(h);
|
323
|
+
}
|
324
|
+
|
325
|
+
void grpc_do_security_handshake(
|
326
|
+
grpc_exec_ctx *exec_ctx, tsi_handshaker *handshaker,
|
327
|
+
grpc_security_connector *connector, bool is_client_side,
|
328
|
+
grpc_endpoint *nonsecure_endpoint, gpr_timespec deadline,
|
329
|
+
grpc_security_handshake_done_cb cb, void *user_data) {
|
301
330
|
grpc_security_connector_handshake_list *handshake_node;
|
302
331
|
grpc_security_handshake *h = gpr_malloc(sizeof(grpc_security_handshake));
|
303
332
|
memset(h, 0, sizeof(grpc_security_handshake));
|
@@ -309,6 +338,7 @@ void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
|
|
309
338
|
h->wrapped_endpoint = nonsecure_endpoint;
|
310
339
|
h->user_data = user_data;
|
311
340
|
h->cb = cb;
|
341
|
+
gpr_ref_init(&h->refs, 2); /* timer and handshake proper each get a ref */
|
312
342
|
grpc_closure_init(&h->on_handshake_data_sent_to_peer,
|
313
343
|
on_handshake_data_sent_to_peer, h);
|
314
344
|
grpc_closure_init(&h->on_handshake_data_received_from_peer,
|
@@ -327,6 +357,8 @@ void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
|
|
327
357
|
gpr_mu_unlock(&server_connector->mu);
|
328
358
|
}
|
329
359
|
send_handshake_bytes_to_peer(exec_ctx, h);
|
360
|
+
grpc_timer_init(exec_ctx, &h->timer, deadline, on_timeout, h,
|
361
|
+
gpr_now(deadline.clock_type));
|
330
362
|
}
|
331
363
|
|
332
364
|
void grpc_security_handshake_shutdown(grpc_exec_ctx *exec_ctx,
|
@@ -31,21 +31,19 @@
|
|
31
31
|
*
|
32
32
|
*/
|
33
33
|
|
34
|
-
#ifndef
|
35
|
-
#define
|
34
|
+
#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_HANDSHAKE_H
|
35
|
+
#define GRPC_CORE_LIB_SECURITY_TRANSPORT_HANDSHAKE_H
|
36
36
|
|
37
37
|
#include "src/core/lib/iomgr/endpoint.h"
|
38
|
-
#include "src/core/lib/security/security_connector.h"
|
38
|
+
#include "src/core/lib/security/transport/security_connector.h"
|
39
39
|
|
40
40
|
/* Calls the callback upon completion. Takes owership of handshaker. */
|
41
|
-
void grpc_do_security_handshake(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
grpc_security_handshake_done_cb cb,
|
47
|
-
void *user_data);
|
41
|
+
void grpc_do_security_handshake(
|
42
|
+
grpc_exec_ctx *exec_ctx, tsi_handshaker *handshaker,
|
43
|
+
grpc_security_connector *connector, bool is_client_side,
|
44
|
+
grpc_endpoint *nonsecure_endpoint, gpr_timespec deadline,
|
45
|
+
grpc_security_handshake_done_cb cb, void *user_data);
|
48
46
|
|
49
47
|
void grpc_security_handshake_shutdown(grpc_exec_ctx *exec_ctx, void *handshake);
|
50
48
|
|
51
|
-
#endif /*
|
49
|
+
#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_HANDSHAKE_H */
|
@@ -31,13 +31,14 @@
|
|
31
31
|
*
|
32
32
|
*/
|
33
33
|
|
34
|
-
#include "src/core/lib/security/secure_endpoint.h"
|
34
|
+
#include "src/core/lib/security/transport/secure_endpoint.h"
|
35
35
|
#include <grpc/support/alloc.h>
|
36
36
|
#include <grpc/support/log.h>
|
37
37
|
#include <grpc/support/slice.h>
|
38
38
|
#include <grpc/support/slice_buffer.h>
|
39
39
|
#include <grpc/support/sync.h>
|
40
40
|
#include "src/core/lib/debug/trace.h"
|
41
|
+
#include "src/core/lib/security/transport/tsi_error.h"
|
41
42
|
#include "src/core/lib/support/string.h"
|
42
43
|
#include "src/core/lib/tsi/transport_security_interface.h"
|
43
44
|
|
@@ -126,8 +127,8 @@ static void flush_read_staging_buffer(secure_endpoint *ep, uint8_t **cur,
|
|
126
127
|
}
|
127
128
|
|
128
129
|
static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
|
129
|
-
|
130
|
-
if (grpc_trace_secure_endpoint) {
|
130
|
+
grpc_error *error) {
|
131
|
+
if (false && grpc_trace_secure_endpoint) {
|
131
132
|
size_t i;
|
132
133
|
for (i = 0; i < ep->read_buffer->count; i++) {
|
133
134
|
char *data = gpr_dump_slice(ep->read_buffer->slices[i],
|
@@ -137,11 +138,12 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
|
|
137
138
|
}
|
138
139
|
}
|
139
140
|
ep->read_buffer = NULL;
|
140
|
-
|
141
|
+
grpc_exec_ctx_sched(exec_ctx, ep->read_cb, error, NULL);
|
141
142
|
SECURE_ENDPOINT_UNREF(exec_ctx, ep, "read");
|
142
143
|
}
|
143
144
|
|
144
|
-
static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
|
145
|
+
static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
|
146
|
+
grpc_error *error) {
|
145
147
|
unsigned i;
|
146
148
|
uint8_t keep_looping = 0;
|
147
149
|
tsi_result result = TSI_OK;
|
@@ -149,9 +151,10 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
|
|
149
151
|
uint8_t *cur = GPR_SLICE_START_PTR(ep->read_staging_buffer);
|
150
152
|
uint8_t *end = GPR_SLICE_END_PTR(ep->read_staging_buffer);
|
151
153
|
|
152
|
-
if (
|
154
|
+
if (error != GRPC_ERROR_NONE) {
|
153
155
|
gpr_slice_buffer_reset_and_unref(ep->read_buffer);
|
154
|
-
call_read_cb(exec_ctx, ep,
|
156
|
+
call_read_cb(exec_ctx, ep, GRPC_ERROR_CREATE_REFERENCING(
|
157
|
+
"Secure read failed", &error, 1));
|
155
158
|
return;
|
156
159
|
}
|
157
160
|
|
@@ -208,11 +211,12 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
|
|
208
211
|
|
209
212
|
if (result != TSI_OK) {
|
210
213
|
gpr_slice_buffer_reset_and_unref(ep->read_buffer);
|
211
|
-
call_read_cb(exec_ctx, ep,
|
214
|
+
call_read_cb(exec_ctx, ep, grpc_set_tsi_error_result(
|
215
|
+
GRPC_ERROR_CREATE("Unwrap failed"), result));
|
212
216
|
return;
|
213
217
|
}
|
214
218
|
|
215
|
-
call_read_cb(exec_ctx, ep,
|
219
|
+
call_read_cb(exec_ctx, ep, GRPC_ERROR_NONE);
|
216
220
|
}
|
217
221
|
|
218
222
|
static void endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
|
@@ -226,7 +230,7 @@ static void endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
|
|
226
230
|
if (ep->leftover_bytes.count) {
|
227
231
|
gpr_slice_buffer_swap(&ep->leftover_bytes, &ep->source_buffer);
|
228
232
|
GPR_ASSERT(ep->leftover_bytes.count == 0);
|
229
|
-
on_read(exec_ctx, ep,
|
233
|
+
on_read(exec_ctx, ep, GRPC_ERROR_NONE);
|
230
234
|
return;
|
231
235
|
}
|
232
236
|
|
@@ -252,7 +256,7 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
|
|
252
256
|
|
253
257
|
gpr_slice_buffer_reset_and_unref(&ep->output_buffer);
|
254
258
|
|
255
|
-
if (grpc_trace_secure_endpoint) {
|
259
|
+
if (false && grpc_trace_secure_endpoint) {
|
256
260
|
for (i = 0; i < slices->count; i++) {
|
257
261
|
char *data =
|
258
262
|
gpr_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
|
@@ -315,7 +319,10 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
|
|
315
319
|
if (result != TSI_OK) {
|
316
320
|
/* TODO(yangg) do different things according to the error type? */
|
317
321
|
gpr_slice_buffer_reset_and_unref(&ep->output_buffer);
|
318
|
-
|
322
|
+
grpc_exec_ctx_sched(
|
323
|
+
exec_ctx, cb,
|
324
|
+
grpc_set_tsi_error_result(GRPC_ERROR_CREATE("Wrap failed"), result),
|
325
|
+
NULL);
|
319
326
|
return;
|
320
327
|
}
|
321
328
|
|