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
@@ -37,13 +37,7 @@
|
|
37
37
|
#include <grpc/support/port_platform.h>
|
38
38
|
#include <grpc/support/slice.h>
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
typedef enum {
|
43
|
-
GRPC_CHTTP2_PARSE_OK,
|
44
|
-
GRPC_CHTTP2_STREAM_ERROR,
|
45
|
-
GRPC_CHTTP2_CONNECTION_ERROR
|
46
|
-
} grpc_chttp2_parse_error;
|
40
|
+
#include "src/core/lib/iomgr/error.h"
|
47
41
|
|
48
42
|
/* defined in internal.h */
|
49
43
|
typedef struct grpc_chttp2_stream_parsing grpc_chttp2_stream_parsing;
|
@@ -37,24 +37,25 @@
|
|
37
37
|
|
38
38
|
#include <grpc/support/alloc.h>
|
39
39
|
#include <grpc/support/log.h>
|
40
|
+
#include <grpc/support/string_util.h>
|
40
41
|
#include <grpc/support/useful.h>
|
41
42
|
#include "src/core/ext/transport/chttp2/transport/internal.h"
|
42
43
|
#include "src/core/lib/support/string.h"
|
43
44
|
#include "src/core/lib/transport/transport.h"
|
44
45
|
|
45
|
-
|
46
|
-
grpc_chttp2_data_parser *parser) {
|
46
|
+
grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser) {
|
47
47
|
parser->state = GRPC_CHTTP2_DATA_FH_0;
|
48
48
|
parser->parsing_frame = NULL;
|
49
|
-
return
|
49
|
+
return GRPC_ERROR_NONE;
|
50
50
|
}
|
51
51
|
|
52
52
|
void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx,
|
53
53
|
grpc_chttp2_data_parser *parser) {
|
54
54
|
grpc_byte_stream *bs;
|
55
55
|
if (parser->parsing_frame) {
|
56
|
-
grpc_chttp2_incoming_byte_stream_finished(
|
57
|
-
|
56
|
+
grpc_chttp2_incoming_byte_stream_finished(
|
57
|
+
exec_ctx, parser->parsing_frame, GRPC_ERROR_CREATE("Parser destroyed"),
|
58
|
+
1);
|
58
59
|
}
|
59
60
|
while (
|
60
61
|
(bs = grpc_chttp2_incoming_frame_queue_pop(&parser->incoming_frames))) {
|
@@ -62,11 +63,16 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx,
|
|
62
63
|
}
|
63
64
|
}
|
64
65
|
|
65
|
-
|
66
|
-
|
66
|
+
grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser,
|
67
|
+
uint8_t flags,
|
68
|
+
uint32_t stream_id) {
|
67
69
|
if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) {
|
68
|
-
|
69
|
-
|
70
|
+
char *msg;
|
71
|
+
gpr_asprintf(&msg, "unsupported data flags: 0x%02x", flags);
|
72
|
+
grpc_error *err = grpc_error_set_int(
|
73
|
+
GRPC_ERROR_CREATE(msg), GRPC_ERROR_INT_STREAM_ID, (intptr_t)stream_id);
|
74
|
+
gpr_free(msg);
|
75
|
+
return err;
|
70
76
|
}
|
71
77
|
|
72
78
|
if (flags & GRPC_CHTTP2_DATA_FLAG_END_STREAM) {
|
@@ -75,7 +81,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_begin_frame(
|
|
75
81
|
parser->is_last_frame = 0;
|
76
82
|
}
|
77
83
|
|
78
|
-
return
|
84
|
+
return GRPC_ERROR_NONE;
|
79
85
|
}
|
80
86
|
|
81
87
|
void grpc_chttp2_incoming_frame_queue_merge(
|
@@ -139,7 +145,7 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
|
|
139
145
|
stats->data_bytes += write_bytes;
|
140
146
|
}
|
141
147
|
|
142
|
-
|
148
|
+
grpc_error *grpc_chttp2_data_parser_parse(
|
143
149
|
grpc_exec_ctx *exec_ctx, void *parser,
|
144
150
|
grpc_chttp2_transport_parsing *transport_parsing,
|
145
151
|
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last) {
|
@@ -149,19 +155,20 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
149
155
|
grpc_chttp2_data_parser *p = parser;
|
150
156
|
uint32_t message_flags;
|
151
157
|
grpc_chttp2_incoming_byte_stream *incoming_byte_stream;
|
158
|
+
char *msg;
|
152
159
|
|
153
160
|
if (is_last && p->is_last_frame) {
|
154
161
|
stream_parsing->received_close = 1;
|
155
162
|
}
|
156
163
|
|
157
164
|
if (cur == end) {
|
158
|
-
return
|
165
|
+
return GRPC_ERROR_NONE;
|
159
166
|
}
|
160
167
|
|
161
168
|
switch (p->state) {
|
162
169
|
case GRPC_CHTTP2_DATA_ERROR:
|
163
170
|
p->state = GRPC_CHTTP2_DATA_ERROR;
|
164
|
-
return
|
171
|
+
return GRPC_ERROR_REF(p->error);
|
165
172
|
fh_0:
|
166
173
|
case GRPC_CHTTP2_DATA_FH_0:
|
167
174
|
stream_parsing->stats.incoming.framing_bytes++;
|
@@ -174,13 +181,23 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
174
181
|
p->is_frame_compressed = 1; /* GPR_TRUE */
|
175
182
|
break;
|
176
183
|
default:
|
177
|
-
|
184
|
+
gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type);
|
185
|
+
p->error = GRPC_ERROR_CREATE(msg);
|
186
|
+
p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID,
|
187
|
+
(intptr_t)stream_parsing->id);
|
188
|
+
gpr_free(msg);
|
189
|
+
msg = gpr_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
|
190
|
+
p->error =
|
191
|
+
grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, msg);
|
192
|
+
gpr_free(msg);
|
193
|
+
p->error =
|
194
|
+
grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg);
|
178
195
|
p->state = GRPC_CHTTP2_DATA_ERROR;
|
179
|
-
return
|
196
|
+
return GRPC_ERROR_REF(p->error);
|
180
197
|
}
|
181
198
|
if (++cur == end) {
|
182
199
|
p->state = GRPC_CHTTP2_DATA_FH_1;
|
183
|
-
return
|
200
|
+
return GRPC_ERROR_NONE;
|
184
201
|
}
|
185
202
|
/* fallthrough */
|
186
203
|
case GRPC_CHTTP2_DATA_FH_1:
|
@@ -188,7 +205,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
188
205
|
p->frame_size = ((uint32_t)*cur) << 24;
|
189
206
|
if (++cur == end) {
|
190
207
|
p->state = GRPC_CHTTP2_DATA_FH_2;
|
191
|
-
return
|
208
|
+
return GRPC_ERROR_NONE;
|
192
209
|
}
|
193
210
|
/* fallthrough */
|
194
211
|
case GRPC_CHTTP2_DATA_FH_2:
|
@@ -196,7 +213,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
196
213
|
p->frame_size |= ((uint32_t)*cur) << 16;
|
197
214
|
if (++cur == end) {
|
198
215
|
p->state = GRPC_CHTTP2_DATA_FH_3;
|
199
|
-
return
|
216
|
+
return GRPC_ERROR_NONE;
|
200
217
|
}
|
201
218
|
/* fallthrough */
|
202
219
|
case GRPC_CHTTP2_DATA_FH_3:
|
@@ -204,7 +221,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
204
221
|
p->frame_size |= ((uint32_t)*cur) << 8;
|
205
222
|
if (++cur == end) {
|
206
223
|
p->state = GRPC_CHTTP2_DATA_FH_4;
|
207
|
-
return
|
224
|
+
return GRPC_ERROR_NONE;
|
208
225
|
}
|
209
226
|
/* fallthrough */
|
210
227
|
case GRPC_CHTTP2_DATA_FH_4:
|
@@ -225,7 +242,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
225
242
|
grpc_chttp2_list_add_parsing_seen_stream(transport_parsing,
|
226
243
|
stream_parsing);
|
227
244
|
if (cur == end) {
|
228
|
-
return
|
245
|
+
return GRPC_ERROR_NONE;
|
229
246
|
}
|
230
247
|
uint32_t remaining = (uint32_t)(end - cur);
|
231
248
|
if (remaining == p->frame_size) {
|
@@ -233,19 +250,19 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
233
250
|
grpc_chttp2_incoming_byte_stream_push(
|
234
251
|
exec_ctx, p->parsing_frame,
|
235
252
|
gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
|
236
|
-
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
|
237
|
-
1);
|
253
|
+
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
|
254
|
+
GRPC_ERROR_NONE, 1);
|
238
255
|
p->parsing_frame = NULL;
|
239
256
|
p->state = GRPC_CHTTP2_DATA_FH_0;
|
240
|
-
return
|
257
|
+
return GRPC_ERROR_NONE;
|
241
258
|
} else if (remaining > p->frame_size) {
|
242
259
|
stream_parsing->stats.incoming.data_bytes += p->frame_size;
|
243
260
|
grpc_chttp2_incoming_byte_stream_push(
|
244
261
|
exec_ctx, p->parsing_frame,
|
245
262
|
gpr_slice_sub(slice, (size_t)(cur - beg),
|
246
263
|
(size_t)(cur + p->frame_size - beg)));
|
247
|
-
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
|
248
|
-
1);
|
264
|
+
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
|
265
|
+
GRPC_ERROR_NONE, 1);
|
249
266
|
p->parsing_frame = NULL;
|
250
267
|
cur += p->frame_size;
|
251
268
|
goto fh_0; /* loop */
|
@@ -256,9 +273,9 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
|
|
256
273
|
gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
|
257
274
|
p->frame_size -= remaining;
|
258
275
|
stream_parsing->stats.incoming.data_bytes += remaining;
|
259
|
-
return
|
276
|
+
return GRPC_ERROR_NONE;
|
260
277
|
}
|
261
278
|
}
|
262
279
|
|
263
|
-
GPR_UNREACHABLE_CODE(return
|
280
|
+
GPR_UNREACHABLE_CODE(return GRPC_ERROR_CREATE("Should never reach here"));
|
264
281
|
}
|
@@ -66,6 +66,7 @@ typedef struct {
|
|
66
66
|
uint8_t is_last_frame;
|
67
67
|
uint8_t frame_type;
|
68
68
|
uint32_t frame_size;
|
69
|
+
grpc_error *error;
|
69
70
|
|
70
71
|
int is_frame_compressed;
|
71
72
|
grpc_chttp2_incoming_frame_queue incoming_frames;
|
@@ -79,19 +80,19 @@ grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop(
|
|
79
80
|
grpc_chttp2_incoming_frame_queue *q);
|
80
81
|
|
81
82
|
/* initialize per-stream state for data frame parsing */
|
82
|
-
|
83
|
-
grpc_chttp2_data_parser *parser);
|
83
|
+
grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser);
|
84
84
|
|
85
85
|
void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx,
|
86
86
|
grpc_chttp2_data_parser *parser);
|
87
87
|
|
88
88
|
/* start processing a new data frame */
|
89
|
-
|
90
|
-
|
89
|
+
grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser,
|
90
|
+
uint8_t flags,
|
91
|
+
uint32_t stream_id);
|
91
92
|
|
92
93
|
/* handle a slice of a data frame - is_last indicates the last slice of a
|
93
94
|
frame */
|
94
|
-
|
95
|
+
grpc_error *grpc_chttp2_data_parser_parse(
|
95
96
|
grpc_exec_ctx *exec_ctx, void *parser,
|
96
97
|
grpc_chttp2_transport_parsing *transport_parsing,
|
97
98
|
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
|
@@ -38,6 +38,7 @@
|
|
38
38
|
|
39
39
|
#include <grpc/support/alloc.h>
|
40
40
|
#include <grpc/support/log.h>
|
41
|
+
#include <grpc/support/string_util.h>
|
41
42
|
|
42
43
|
void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser *p) {
|
43
44
|
p->debug_data = NULL;
|
@@ -47,11 +48,15 @@ void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser *p) {
|
|
47
48
|
gpr_free(p->debug_data);
|
48
49
|
}
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
grpc_error *grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser *p,
|
52
|
+
uint32_t length,
|
53
|
+
uint8_t flags) {
|
52
54
|
if (length < 8) {
|
53
|
-
|
54
|
-
|
55
|
+
char *msg;
|
56
|
+
gpr_asprintf(&msg, "goaway frame too short (%d bytes)", length);
|
57
|
+
grpc_error *err = GRPC_ERROR_CREATE(msg);
|
58
|
+
gpr_free(msg);
|
59
|
+
return err;
|
55
60
|
}
|
56
61
|
|
57
62
|
gpr_free(p->debug_data);
|
@@ -59,10 +64,10 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_begin_frame(
|
|
59
64
|
p->debug_data = gpr_malloc(p->debug_length);
|
60
65
|
p->debug_pos = 0;
|
61
66
|
p->state = GRPC_CHTTP2_GOAWAY_LSI0;
|
62
|
-
return
|
67
|
+
return GRPC_ERROR_NONE;
|
63
68
|
}
|
64
69
|
|
65
|
-
|
70
|
+
grpc_error *grpc_chttp2_goaway_parser_parse(
|
66
71
|
grpc_exec_ctx *exec_ctx, void *parser,
|
67
72
|
grpc_chttp2_transport_parsing *transport_parsing,
|
68
73
|
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last) {
|
@@ -75,7 +80,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
75
80
|
case GRPC_CHTTP2_GOAWAY_LSI0:
|
76
81
|
if (cur == end) {
|
77
82
|
p->state = GRPC_CHTTP2_GOAWAY_LSI0;
|
78
|
-
return
|
83
|
+
return GRPC_ERROR_NONE;
|
79
84
|
}
|
80
85
|
p->last_stream_id = ((uint32_t)*cur) << 24;
|
81
86
|
++cur;
|
@@ -83,7 +88,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
83
88
|
case GRPC_CHTTP2_GOAWAY_LSI1:
|
84
89
|
if (cur == end) {
|
85
90
|
p->state = GRPC_CHTTP2_GOAWAY_LSI1;
|
86
|
-
return
|
91
|
+
return GRPC_ERROR_NONE;
|
87
92
|
}
|
88
93
|
p->last_stream_id |= ((uint32_t)*cur) << 16;
|
89
94
|
++cur;
|
@@ -91,7 +96,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
91
96
|
case GRPC_CHTTP2_GOAWAY_LSI2:
|
92
97
|
if (cur == end) {
|
93
98
|
p->state = GRPC_CHTTP2_GOAWAY_LSI2;
|
94
|
-
return
|
99
|
+
return GRPC_ERROR_NONE;
|
95
100
|
}
|
96
101
|
p->last_stream_id |= ((uint32_t)*cur) << 8;
|
97
102
|
++cur;
|
@@ -99,7 +104,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
99
104
|
case GRPC_CHTTP2_GOAWAY_LSI3:
|
100
105
|
if (cur == end) {
|
101
106
|
p->state = GRPC_CHTTP2_GOAWAY_LSI3;
|
102
|
-
return
|
107
|
+
return GRPC_ERROR_NONE;
|
103
108
|
}
|
104
109
|
p->last_stream_id |= ((uint32_t)*cur);
|
105
110
|
++cur;
|
@@ -107,7 +112,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
107
112
|
case GRPC_CHTTP2_GOAWAY_ERR0:
|
108
113
|
if (cur == end) {
|
109
114
|
p->state = GRPC_CHTTP2_GOAWAY_ERR0;
|
110
|
-
return
|
115
|
+
return GRPC_ERROR_NONE;
|
111
116
|
}
|
112
117
|
p->error_code = ((uint32_t)*cur) << 24;
|
113
118
|
++cur;
|
@@ -115,7 +120,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
115
120
|
case GRPC_CHTTP2_GOAWAY_ERR1:
|
116
121
|
if (cur == end) {
|
117
122
|
p->state = GRPC_CHTTP2_GOAWAY_ERR1;
|
118
|
-
return
|
123
|
+
return GRPC_ERROR_NONE;
|
119
124
|
}
|
120
125
|
p->error_code |= ((uint32_t)*cur) << 16;
|
121
126
|
++cur;
|
@@ -123,7 +128,7 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
123
128
|
case GRPC_CHTTP2_GOAWAY_ERR2:
|
124
129
|
if (cur == end) {
|
125
130
|
p->state = GRPC_CHTTP2_GOAWAY_ERR2;
|
126
|
-
return
|
131
|
+
return GRPC_ERROR_NONE;
|
127
132
|
}
|
128
133
|
p->error_code |= ((uint32_t)*cur) << 8;
|
129
134
|
++cur;
|
@@ -131,13 +136,14 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
131
136
|
case GRPC_CHTTP2_GOAWAY_ERR3:
|
132
137
|
if (cur == end) {
|
133
138
|
p->state = GRPC_CHTTP2_GOAWAY_ERR3;
|
134
|
-
return
|
139
|
+
return GRPC_ERROR_NONE;
|
135
140
|
}
|
136
141
|
p->error_code |= ((uint32_t)*cur);
|
137
142
|
++cur;
|
138
143
|
/* fallthrough */
|
139
144
|
case GRPC_CHTTP2_GOAWAY_DEBUG:
|
140
|
-
|
145
|
+
if (end != cur)
|
146
|
+
memcpy(p->debug_data + p->debug_pos, cur, (size_t)(end - cur));
|
141
147
|
GPR_ASSERT((size_t)(end - cur) < UINT32_MAX - p->debug_pos);
|
142
148
|
p->debug_pos += (uint32_t)(end - cur);
|
143
149
|
p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
|
@@ -150,9 +156,9 @@ grpc_chttp2_parse_error grpc_chttp2_goaway_parser_parse(
|
|
150
156
|
gpr_slice_new(p->debug_data, p->debug_length, gpr_free);
|
151
157
|
p->debug_data = NULL;
|
152
158
|
}
|
153
|
-
return
|
159
|
+
return GRPC_ERROR_NONE;
|
154
160
|
}
|
155
|
-
GPR_UNREACHABLE_CODE(return
|
161
|
+
GPR_UNREACHABLE_CODE(return GRPC_ERROR_CREATE("Should never reach here"));
|
156
162
|
}
|
157
163
|
|
158
164
|
void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
|
@@ -63,9 +63,9 @@ typedef struct {
|
|
63
63
|
|
64
64
|
void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser *p);
|
65
65
|
void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser *p);
|
66
|
-
|
66
|
+
grpc_error *grpc_chttp2_goaway_parser_begin_frame(
|
67
67
|
grpc_chttp2_goaway_parser *parser, uint32_t length, uint8_t flags);
|
68
|
-
|
68
|
+
grpc_error *grpc_chttp2_goaway_parser_parse(
|
69
69
|
grpc_exec_ctx *exec_ctx, void *parser,
|
70
70
|
grpc_chttp2_transport_parsing *transport_parsing,
|
71
71
|
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
|
@@ -38,6 +38,7 @@
|
|
38
38
|
|
39
39
|
#include <grpc/support/alloc.h>
|
40
40
|
#include <grpc/support/log.h>
|
41
|
+
#include <grpc/support/string_util.h>
|
41
42
|
|
42
43
|
gpr_slice grpc_chttp2_ping_create(uint8_t ack, uint8_t *opaque_8bytes) {
|
43
44
|
gpr_slice slice = gpr_slice_malloc(9 + 8);
|
@@ -57,18 +58,22 @@ gpr_slice grpc_chttp2_ping_create(uint8_t ack, uint8_t *opaque_8bytes) {
|
|
57
58
|
return slice;
|
58
59
|
}
|
59
60
|
|
60
|
-
|
61
|
-
|
61
|
+
grpc_error *grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser *parser,
|
62
|
+
uint32_t length,
|
63
|
+
uint8_t flags) {
|
62
64
|
if (flags & 0xfe || length != 8) {
|
63
|
-
|
64
|
-
|
65
|
+
char *msg;
|
66
|
+
gpr_asprintf(&msg, "invalid ping: length=%d, flags=%02x", length, flags);
|
67
|
+
grpc_error *error = GRPC_ERROR_CREATE(msg);
|
68
|
+
gpr_free(msg);
|
69
|
+
return error;
|
65
70
|
}
|
66
71
|
parser->byte = 0;
|
67
72
|
parser->is_ack = flags;
|
68
|
-
return
|
73
|
+
return GRPC_ERROR_NONE;
|
69
74
|
}
|
70
75
|
|
71
|
-
|
76
|
+
grpc_error *grpc_chttp2_ping_parser_parse(
|
72
77
|
grpc_exec_ctx *exec_ctx, void *parser,
|
73
78
|
grpc_chttp2_transport_parsing *transport_parsing,
|
74
79
|
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last) {
|
@@ -93,5 +98,5 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse(
|
|
93
98
|
}
|
94
99
|
}
|
95
100
|
|
96
|
-
return
|
101
|
+
return GRPC_ERROR_NONE;
|
97
102
|
}
|
@@ -46,9 +46,9 @@ typedef struct {
|
|
46
46
|
|
47
47
|
gpr_slice grpc_chttp2_ping_create(uint8_t ack, uint8_t *opaque_8bytes);
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
grpc_error *grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser *parser,
|
50
|
+
uint32_t length, uint8_t flags);
|
51
|
+
grpc_error *grpc_chttp2_ping_parser_parse(
|
52
52
|
grpc_exec_ctx *exec_ctx, void *parser,
|
53
53
|
grpc_chttp2_transport_parsing *transport_parsing,
|
54
54
|
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
|
@@ -34,7 +34,9 @@
|
|
34
34
|
#include "src/core/ext/transport/chttp2/transport/frame_rst_stream.h"
|
35
35
|
#include "src/core/ext/transport/chttp2/transport/internal.h"
|
36
36
|
|
37
|
+
#include <grpc/support/alloc.h>
|
37
38
|
#include <grpc/support/log.h>
|
39
|
+
#include <grpc/support/string_util.h>
|
38
40
|
|
39
41
|
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
40
42
|
|
@@ -45,15 +47,20 @@ gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
|
|
45
47
|
stats->framing_bytes += frame_size;
|
46
48
|
uint8_t *p = GPR_SLICE_START_PTR(slice);
|
47
49
|
|
50
|
+
// Frame size.
|
48
51
|
*p++ = 0;
|
49
52
|
*p++ = 0;
|
50
53
|
*p++ = 4;
|
54
|
+
// Frame type.
|
51
55
|
*p++ = GRPC_CHTTP2_FRAME_RST_STREAM;
|
56
|
+
// Flags.
|
52
57
|
*p++ = 0;
|
58
|
+
// Stream ID.
|
53
59
|
*p++ = (uint8_t)(id >> 24);
|
54
60
|
*p++ = (uint8_t)(id >> 16);
|
55
61
|
*p++ = (uint8_t)(id >> 8);
|
56
62
|
*p++ = (uint8_t)(id);
|
63
|
+
// Error code.
|
57
64
|
*p++ = (uint8_t)(code >> 24);
|
58
65
|
*p++ = (uint8_t)(code >> 16);
|
59
66
|
*p++ = (uint8_t)(code >> 8);
|
@@ -62,18 +69,21 @@ gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
|
|
62
69
|
return slice;
|
63
70
|
}
|
64
71
|
|
65
|
-
|
72
|
+
grpc_error *grpc_chttp2_rst_stream_parser_begin_frame(
|
66
73
|
grpc_chttp2_rst_stream_parser *parser, uint32_t length, uint8_t flags) {
|
67
74
|
if (length != 4) {
|
68
|
-
|
69
|
-
|
70
|
-
|
75
|
+
char *msg;
|
76
|
+
gpr_asprintf(&msg, "invalid rst_stream: length=%d, flags=%02x", length,
|
77
|
+
flags);
|
78
|
+
grpc_error *err = GRPC_ERROR_CREATE(msg);
|
79
|
+
gpr_free(msg);
|
80
|
+
return err;
|
71
81
|
}
|
72
82
|
parser->byte = 0;
|
73
|
-
return
|
83
|
+
return GRPC_ERROR_NONE;
|
74
84
|
}
|
75
85
|
|
76
|
-
|
86
|
+
grpc_error *grpc_chttp2_rst_stream_parser_parse(
|
77
87
|
grpc_exec_ctx *exec_ctx, void *parser,
|
78
88
|
grpc_chttp2_transport_parsing *transport_parsing,
|
79
89
|
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last) {
|
@@ -92,12 +102,15 @@ grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_parse(
|
|
92
102
|
if (p->byte == 4) {
|
93
103
|
GPR_ASSERT(is_last);
|
94
104
|
stream_parsing->received_close = 1;
|
95
|
-
stream_parsing->
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
105
|
+
if (stream_parsing->forced_close_error == GRPC_ERROR_NONE) {
|
106
|
+
stream_parsing->forced_close_error = grpc_error_set_int(
|
107
|
+
GRPC_ERROR_CREATE("RST_STREAM"), GRPC_ERROR_INT_HTTP2_ERROR,
|
108
|
+
(intptr_t)((((uint32_t)p->reason_bytes[0]) << 24) |
|
109
|
+
(((uint32_t)p->reason_bytes[1]) << 16) |
|
110
|
+
(((uint32_t)p->reason_bytes[2]) << 8) |
|
111
|
+
(((uint32_t)p->reason_bytes[3]))));
|
112
|
+
}
|
100
113
|
}
|
101
114
|
|
102
|
-
return
|
115
|
+
return GRPC_ERROR_NONE;
|
103
116
|
}
|