grpc 1.1.2 → 1.2.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 +1257 -404
- data/etc/roots.pem +189 -102
- data/include/grpc/census.h +7 -7
- data/include/grpc/compression.h +4 -4
- data/include/grpc/grpc.h +13 -7
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +26 -9
- data/include/grpc/impl/codegen/grpc_types.h +39 -30
- data/include/grpc/impl/codegen/slice.h +24 -6
- data/include/grpc/impl/codegen/sync.h +8 -0
- data/include/grpc/load_reporting.h +63 -0
- data/include/grpc/slice.h +37 -1
- data/include/grpc/slice_buffer.h +7 -0
- data/include/grpc/support/alloc.h +3 -0
- data/include/grpc/support/useful.h +3 -0
- data/src/core/ext/census/gen/census.pb.h +1 -1
- data/src/core/ext/census/gen/trace_context.pb.c +9 -36
- data/src/core/ext/census/gen/trace_context.pb.h +20 -26
- data/src/core/ext/census/grpc_filter.c +3 -5
- data/src/core/ext/census/trace_context.c +1 -1
- data/src/core/ext/census/trace_context.h +3 -0
- data/src/core/ext/census/trace_label.h +61 -0
- data/src/core/ext/census/trace_propagation.h +63 -0
- data/src/core/ext/census/trace_status.h +45 -0
- data/src/core/ext/census/trace_string.h +50 -0
- data/src/core/ext/census/tracing.c +31 -11
- data/src/core/ext/census/tracing.h +124 -0
- data/src/core/ext/client_channel/client_channel.c +456 -368
- data/src/core/ext/client_channel/client_channel.h +4 -0
- data/src/core/ext/client_channel/client_channel_plugin.c +6 -1
- data/src/core/ext/client_channel/connector.c +3 -3
- data/src/core/ext/client_channel/connector.h +4 -3
- data/src/core/ext/client_channel/http_connect_handshaker.c +62 -72
- data/src/core/ext/client_channel/http_connect_handshaker.h +7 -10
- data/src/core/ext/client_channel/http_proxy.c +125 -0
- data/src/core/ext/client_channel/http_proxy.h +39 -0
- data/src/core/ext/client_channel/lb_policy.c +56 -35
- data/src/core/ext/client_channel/lb_policy.h +46 -39
- data/src/core/ext/client_channel/lb_policy_factory.h +1 -0
- data/src/core/ext/client_channel/parse_address.c +32 -6
- data/src/core/ext/client_channel/proxy_mapper.c +63 -0
- data/src/core/ext/client_channel/proxy_mapper.h +89 -0
- data/src/core/ext/client_channel/proxy_mapper_registry.c +133 -0
- data/src/core/ext/client_channel/proxy_mapper_registry.h +59 -0
- data/src/core/ext/client_channel/resolver.c +16 -9
- data/src/core/ext/client_channel/resolver.h +23 -12
- data/src/core/ext/client_channel/resolver_factory.h +1 -0
- data/src/core/ext/client_channel/resolver_registry.c +15 -11
- data/src/core/ext/client_channel/resolver_registry.h +5 -3
- data/src/core/ext/client_channel/subchannel.c +44 -27
- data/src/core/ext/client_channel/subchannel.h +6 -2
- data/src/core/ext/client_channel/uri_parser.c +26 -14
- data/src/core/ext/client_channel/uri_parser.h +3 -1
- data/src/core/ext/lb_policy/grpclb/grpclb.c +220 -209
- data/src/core/ext/lb_policy/grpclb/grpclb_channel.h +56 -0
- data/src/core/ext/lb_policy/grpclb/grpclb_channel_secure.c +107 -0
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +3 -6
- data/src/core/ext/lb_policy/pick_first/pick_first.c +71 -116
- data/src/core/ext/lb_policy/round_robin/round_robin.c +52 -67
- data/src/core/ext/load_reporting/load_reporting.c +20 -0
- data/src/core/ext/load_reporting/load_reporting.h +1 -16
- data/src/core/ext/load_reporting/load_reporting_filter.c +28 -54
- data/src/core/ext/resolver/dns/native/dns_resolver.c +31 -45
- data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +20 -29
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +11 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +11 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +143 -46
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +12 -50
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +1 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +1 -1
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +7 -7
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +1 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +0 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +606 -374
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +17 -5
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +9 -13
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +12 -11
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +5 -6
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +100 -53
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +126 -70
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +13 -7
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +22 -19
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +6 -6
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +23 -11
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +6 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +169 -42
- data/src/core/ext/transport/chttp2/transport/parsing.c +98 -41
- data/src/core/ext/transport/chttp2/transport/stream_lists.c +29 -14
- data/src/core/ext/transport/chttp2/transport/writing.c +137 -15
- data/src/core/lib/channel/channel_stack.c +14 -44
- data/src/core/lib/channel/channel_stack.h +10 -17
- data/src/core/lib/channel/channel_stack_builder.c +2 -3
- data/src/core/lib/channel/compress_filter.c +54 -46
- data/src/core/lib/channel/connected_channel.c +4 -4
- data/src/core/lib/channel/connected_channel.h +5 -0
- data/src/core/lib/channel/context.h +3 -0
- data/src/core/lib/channel/deadline_filter.c +61 -61
- data/src/core/lib/channel/deadline_filter.h +8 -5
- data/src/core/lib/channel/handshaker.c +47 -7
- data/src/core/lib/channel/handshaker.h +21 -3
- data/src/core/lib/channel/http_client_filter.c +149 -99
- data/src/core/lib/channel/http_server_filter.c +163 -147
- data/src/core/lib/channel/message_size_filter.c +15 -10
- data/src/core/lib/compression/algorithm_metadata.h +4 -4
- data/src/core/lib/compression/compression.c +17 -23
- data/src/core/lib/http/httpcli.c +3 -2
- data/src/core/lib/http/httpcli.h +2 -1
- data/src/core/lib/http/httpcli_security_connector.c +2 -3
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/iomgr/closure.c +6 -3
- data/src/core/lib/iomgr/closure.h +4 -2
- data/src/core/lib/iomgr/combiner.c +35 -5
- data/src/core/lib/iomgr/combiner.h +21 -2
- data/src/core/lib/iomgr/endpoint.c +3 -2
- data/src/core/lib/iomgr/endpoint.h +3 -2
- data/src/core/lib/iomgr/error.c +60 -94
- data/src/core/lib/iomgr/error.h +7 -10
- data/src/core/lib/iomgr/error_internal.h +54 -0
- data/src/core/lib/iomgr/ev_epoll_linux.c +253 -109
- data/src/core/lib/iomgr/ev_poll_posix.c +61 -29
- data/src/core/lib/iomgr/ev_posix.c +7 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -4
- data/src/core/lib/iomgr/exec_ctx.c +11 -6
- data/src/core/lib/iomgr/exec_ctx.h +11 -14
- data/src/core/lib/iomgr/executor.c +2 -2
- data/src/core/lib/iomgr/load_file.c +1 -1
- data/src/core/lib/iomgr/network_status_tracker.c +5 -81
- data/src/core/lib/iomgr/pollset.h +1 -3
- data/src/core/lib/iomgr/pollset_set.h +2 -1
- data/src/core/lib/iomgr/pollset_set_uv.c +2 -1
- data/src/core/lib/iomgr/pollset_set_windows.c +2 -1
- data/src/core/lib/iomgr/pollset_uv.c +25 -11
- data/src/core/lib/iomgr/pollset_windows.c +0 -11
- data/src/core/lib/iomgr/resolve_address_uv.c +50 -2
- data/src/core/lib/iomgr/resource_quota.c +41 -11
- data/src/core/lib/iomgr/resource_quota.h +6 -0
- data/src/core/lib/iomgr/sockaddr_utils.c +33 -17
- data/src/core/lib/iomgr/sockaddr_utils.h +4 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +2 -3
- data/src/core/lib/iomgr/tcp_client_uv.c +1 -3
- data/src/core/lib/iomgr/tcp_client_windows.c +21 -6
- data/src/core/lib/iomgr/tcp_posix.c +4 -5
- data/src/core/lib/iomgr/tcp_server_posix.c +269 -94
- data/src/core/lib/iomgr/tcp_server_windows.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +11 -5
- data/src/core/lib/iomgr/tcp_windows.c +20 -7
- data/src/core/lib/iomgr/timer_generic.c +15 -22
- data/src/core/lib/iomgr/timer_generic.h +1 -1
- data/src/core/lib/iomgr/timer_uv.c +10 -6
- data/src/core/lib/iomgr/timer_uv.h +1 -1
- data/src/core/lib/iomgr/udp_server.c +45 -6
- data/src/core/lib/iomgr/udp_server.h +7 -1
- data/src/core/lib/iomgr/unix_sockets_posix.c +11 -1
- data/src/core/lib/json/json.c +1 -2
- data/src/core/lib/profiling/basic_timers.c +17 -3
- data/src/core/lib/security/context/security_context.c +3 -10
- data/src/core/lib/security/credentials/composite/composite_credentials.c +4 -8
- data/src/core/lib/security/credentials/credentials.c +48 -2
- data/src/core/lib/security/credentials/credentials.h +13 -0
- data/src/core/lib/security/credentials/credentials_metadata.c +1 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.c +6 -8
- data/src/core/lib/security/credentials/fake/fake_credentials.h +15 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +3 -3
- data/src/core/lib/security/credentials/iam/iam_credentials.c +1 -2
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +5 -8
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +2 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +3 -5
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +15 -13
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +2 -4
- data/src/core/lib/security/transport/client_auth_filter.c +72 -47
- data/src/core/lib/security/transport/lb_targets_info.c +70 -0
- data/src/core/lib/security/transport/lb_targets_info.h +47 -0
- data/src/core/lib/security/transport/secure_endpoint.c +3 -3
- data/src/core/lib/security/transport/security_connector.c +125 -28
- data/src/core/lib/security/transport/security_connector.h +4 -3
- data/src/core/lib/security/transport/security_handshaker.c +13 -9
- data/src/core/lib/security/transport/server_auth_filter.c +31 -40
- data/src/core/lib/security/util/b64.c +1 -1
- data/src/core/lib/slice/slice.c +110 -20
- data/src/core/lib/slice/slice_buffer.c +92 -39
- data/src/core/lib/{transport/mdstr_hash_table.c → slice/slice_hash_table.c} +40 -33
- data/src/core/lib/{transport/mdstr_hash_table.h → slice/slice_hash_table.h} +21 -21
- data/src/core/lib/slice/slice_intern.c +346 -0
- data/src/core/lib/slice/slice_internal.h +15 -0
- data/src/core/lib/slice/slice_string_helpers.c +5 -0
- data/src/core/lib/slice/slice_string_helpers.h +5 -0
- data/src/core/lib/support/alloc.c +26 -1
- data/src/core/lib/support/cmdline.c +2 -4
- data/src/core/lib/support/cpu_posix.c +2 -7
- data/src/core/lib/support/histogram.c +1 -2
- data/src/core/lib/support/log_posix.c +8 -4
- data/src/core/lib/support/spinlock.h +52 -0
- data/src/core/lib/support/subprocess_posix.c +1 -2
- data/src/core/lib/support/sync.c +7 -1
- data/src/core/lib/support/sync_posix.c +9 -0
- data/src/core/lib/support/time_windows.c +7 -1
- data/src/core/lib/surface/call.c +647 -629
- data/src/core/lib/surface/call.h +4 -1
- data/src/core/lib/surface/call_details.c +8 -2
- data/src/core/lib/surface/call_log_batch.c +17 -6
- data/src/core/lib/surface/channel.c +49 -59
- data/src/core/lib/surface/channel.h +5 -6
- data/src/core/lib/surface/completion_queue.c +16 -45
- data/src/core/lib/surface/completion_queue.h +0 -3
- data/src/core/lib/surface/init.c +6 -2
- data/src/core/lib/surface/init_secure.c +1 -1
- data/src/core/lib/surface/lame_client.c +14 -4
- data/src/core/lib/surface/server.c +79 -82
- data/src/core/lib/surface/validate_metadata.c +46 -15
- data/src/core/lib/surface/validate_metadata.h +43 -0
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +104 -0
- data/src/core/lib/transport/bdp_estimator.h +76 -0
- data/src/core/lib/transport/connectivity_state.c +33 -13
- data/src/core/lib/transport/connectivity_state.h +15 -5
- data/src/core/lib/transport/error_utils.c +124 -0
- data/src/core/lib/transport/error_utils.h +56 -0
- data/src/core/{ext/transport/chttp2 → lib}/transport/http2_errors.h +18 -18
- data/src/core/lib/transport/metadata.c +259 -503
- data/src/core/lib/transport/metadata.h +69 -68
- data/src/core/lib/transport/metadata_batch.c +183 -63
- data/src/core/lib/transport/metadata_batch.h +50 -26
- data/src/core/lib/transport/pid_controller.c +28 -8
- data/src/core/lib/transport/pid_controller.h +15 -2
- data/src/core/lib/transport/service_config.c +21 -18
- data/src/core/lib/transport/service_config.h +5 -5
- data/src/core/lib/transport/static_metadata.c +753 -112
- data/src/core/lib/transport/static_metadata.h +403 -264
- data/src/core/{ext/transport/chttp2 → lib}/transport/status_conversion.c +18 -20
- data/src/core/{ext/transport/chttp2 → lib}/transport/status_conversion.h +9 -10
- data/src/core/lib/transport/timeout_encoding.c +11 -9
- data/src/core/lib/transport/timeout_encoding.h +3 -1
- data/src/core/lib/transport/transport.c +47 -87
- data/src/core/lib/transport/transport.h +20 -25
- data/src/core/lib/transport/transport_op_string.c +7 -19
- data/src/core/lib/tsi/fake_transport_security.c +2 -4
- data/src/core/lib/tsi/ssl_transport_security.c +7 -16
- data/src/core/lib/tsi/transport_security.c +2 -4
- data/src/ruby/ext/grpc/extconf.rb +4 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +7 -0
- data/src/ruby/ext/grpc/rb_byte_buffer.h +3 -0
- data/src/ruby/ext/grpc/rb_call.c +47 -46
- data/src/ruby/ext/grpc/rb_channel.c +21 -6
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +36 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +59 -8
- data/src/ruby/ext/grpc/rb_server.c +6 -4
- data/src/ruby/lib/grpc/generic/client_stub.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +33 -9
@@ -170,10 +170,9 @@ grpc_error *grpc_call_stack_init(
|
|
170
170
|
grpc_exec_ctx *exec_ctx, grpc_channel_stack *channel_stack,
|
171
171
|
int initial_refs, grpc_iomgr_cb_func destroy, void *destroy_arg,
|
172
172
|
grpc_call_context_element *context, const void *transport_server_data,
|
173
|
-
|
173
|
+
grpc_slice path, gpr_timespec start_time, gpr_timespec deadline,
|
174
174
|
grpc_call_stack *call_stack) {
|
175
175
|
grpc_channel_element *channel_elems = CHANNEL_ELEMS_FROM_STACK(channel_stack);
|
176
|
-
grpc_call_element_args args;
|
177
176
|
size_t count = channel_stack->count;
|
178
177
|
grpc_call_element *call_elems;
|
179
178
|
char *user_data;
|
@@ -188,13 +187,15 @@ grpc_error *grpc_call_stack_init(
|
|
188
187
|
|
189
188
|
/* init per-filter data */
|
190
189
|
grpc_error *first_error = GRPC_ERROR_NONE;
|
191
|
-
args
|
190
|
+
const grpc_call_element_args args = {
|
191
|
+
.start_time = start_time,
|
192
|
+
.call_stack = call_stack,
|
193
|
+
.server_transport_data = transport_server_data,
|
194
|
+
.context = context,
|
195
|
+
.path = path,
|
196
|
+
.deadline = deadline,
|
197
|
+
};
|
192
198
|
for (i = 0; i < count; i++) {
|
193
|
-
args.call_stack = call_stack;
|
194
|
-
args.server_transport_data = transport_server_data;
|
195
|
-
args.context = context;
|
196
|
-
args.path = path;
|
197
|
-
args.deadline = deadline;
|
198
199
|
call_elems[i].filter = channel_elems[i].filter;
|
199
200
|
call_elems[i].channel_data = channel_elems[i].channel_data;
|
200
201
|
call_elems[i].call_data = user_data;
|
@@ -288,41 +289,10 @@ grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem) {
|
|
288
289
|
sizeof(grpc_call_stack)));
|
289
290
|
}
|
290
291
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
grpc_call_element *elem) {
|
297
|
-
grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
|
298
|
-
memset(op, 0, sizeof(*op));
|
299
|
-
op->cancel_error = GRPC_ERROR_CANCELLED;
|
300
|
-
op->on_complete =
|
301
|
-
grpc_closure_create(destroy_op, op, grpc_schedule_on_exec_ctx);
|
302
|
-
elem->filter->start_transport_stream_op(exec_ctx, elem, op);
|
303
|
-
}
|
304
|
-
|
305
|
-
void grpc_call_element_send_cancel_with_message(grpc_exec_ctx *exec_ctx,
|
306
|
-
grpc_call_element *elem,
|
307
|
-
grpc_status_code status,
|
308
|
-
grpc_slice *optional_message) {
|
309
|
-
grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
|
310
|
-
memset(op, 0, sizeof(*op));
|
311
|
-
op->on_complete =
|
312
|
-
grpc_closure_create(destroy_op, op, grpc_schedule_on_exec_ctx);
|
313
|
-
grpc_transport_stream_op_add_cancellation_with_message(exec_ctx, op, status,
|
314
|
-
optional_message);
|
315
|
-
elem->filter->start_transport_stream_op(exec_ctx, elem, op);
|
316
|
-
}
|
317
|
-
|
318
|
-
void grpc_call_element_send_close_with_message(grpc_exec_ctx *exec_ctx,
|
319
|
-
grpc_call_element *elem,
|
320
|
-
grpc_status_code status,
|
321
|
-
grpc_slice *optional_message) {
|
322
|
-
grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
|
323
|
-
memset(op, 0, sizeof(*op));
|
324
|
-
op->on_complete =
|
325
|
-
grpc_closure_create(destroy_op, op, grpc_schedule_on_exec_ctx);
|
326
|
-
grpc_transport_stream_op_add_close(exec_ctx, op, status, optional_message);
|
292
|
+
void grpc_call_element_signal_error(grpc_exec_ctx *exec_ctx,
|
293
|
+
grpc_call_element *elem,
|
294
|
+
grpc_error *error) {
|
295
|
+
grpc_transport_stream_op *op = grpc_make_transport_stream_op(NULL);
|
296
|
+
op->cancel_error = error;
|
327
297
|
elem->filter->start_transport_stream_op(exec_ctx, elem, op);
|
328
298
|
}
|
@@ -81,7 +81,7 @@ typedef struct {
|
|
81
81
|
grpc_call_stack *call_stack;
|
82
82
|
const void *server_transport_data;
|
83
83
|
grpc_call_context_element *context;
|
84
|
-
|
84
|
+
grpc_slice path;
|
85
85
|
gpr_timespec start_time;
|
86
86
|
gpr_timespec deadline;
|
87
87
|
} grpc_call_element_args;
|
@@ -128,10 +128,11 @@ typedef struct {
|
|
128
128
|
server_transport_data is an opaque pointer. If it is NULL, this call is
|
129
129
|
on a client; if it is non-NULL, then it points to memory owned by the
|
130
130
|
transport and is on the server. Most filters want to ignore this
|
131
|
-
argument.
|
131
|
+
argument.
|
132
|
+
Implementations may assume that elem->call_data is all zeros. */
|
132
133
|
grpc_error *(*init_call_elem)(grpc_exec_ctx *exec_ctx,
|
133
134
|
grpc_call_element *elem,
|
134
|
-
grpc_call_element_args *args);
|
135
|
+
const grpc_call_element_args *args);
|
135
136
|
void (*set_pollset_or_pollset_set)(grpc_exec_ctx *exec_ctx,
|
136
137
|
grpc_call_element *elem,
|
137
138
|
grpc_polling_entity *pollent);
|
@@ -152,7 +153,8 @@ typedef struct {
|
|
152
153
|
is what needs initializing.
|
153
154
|
is_first, is_last designate this elements position in the stack, and are
|
154
155
|
useful for asserting correct configuration by upper layer code.
|
155
|
-
The filter does not need to do any chaining
|
156
|
+
The filter does not need to do any chaining.
|
157
|
+
Implementations may assume that elem->call_data is all zeros. */
|
156
158
|
grpc_error *(*init_channel_elem)(grpc_exec_ctx *exec_ctx,
|
157
159
|
grpc_channel_element *elem,
|
158
160
|
grpc_channel_element_args *args);
|
@@ -238,7 +240,7 @@ grpc_error *grpc_call_stack_init(
|
|
238
240
|
grpc_exec_ctx *exec_ctx, grpc_channel_stack *channel_stack,
|
239
241
|
int initial_refs, grpc_iomgr_cb_func destroy, void *destroy_arg,
|
240
242
|
grpc_call_context_element *context, const void *transport_server_data,
|
241
|
-
|
243
|
+
grpc_slice path, gpr_timespec start_time, gpr_timespec deadline,
|
242
244
|
grpc_call_stack *call_stack);
|
243
245
|
/* Set a pollset or a pollset_set for a call stack: must occur before the first
|
244
246
|
* op is started */
|
@@ -299,18 +301,9 @@ grpc_call_stack *grpc_call_stack_from_top_element(grpc_call_element *elem);
|
|
299
301
|
void grpc_call_log_op(char *file, int line, gpr_log_severity severity,
|
300
302
|
grpc_call_element *elem, grpc_transport_stream_op *op);
|
301
303
|
|
302
|
-
void
|
303
|
-
|
304
|
-
|
305
|
-
void grpc_call_element_send_cancel_with_message(grpc_exec_ctx *exec_ctx,
|
306
|
-
grpc_call_element *cur_elem,
|
307
|
-
grpc_status_code status,
|
308
|
-
grpc_slice *optional_message);
|
309
|
-
|
310
|
-
void grpc_call_element_send_close_with_message(grpc_exec_ctx *exec_ctx,
|
311
|
-
grpc_call_element *cur_elem,
|
312
|
-
grpc_status_code status,
|
313
|
-
grpc_slice *optional_message);
|
304
|
+
void grpc_call_element_signal_error(grpc_exec_ctx *exec_ctx,
|
305
|
+
grpc_call_element *cur_elem,
|
306
|
+
grpc_error *error);
|
314
307
|
|
315
308
|
extern int grpc_trace_channel;
|
316
309
|
|
@@ -65,8 +65,7 @@ struct grpc_channel_stack_builder_iterator {
|
|
65
65
|
};
|
66
66
|
|
67
67
|
grpc_channel_stack_builder *grpc_channel_stack_builder_create(void) {
|
68
|
-
grpc_channel_stack_builder *b =
|
69
|
-
memset(b, 0, sizeof(*b));
|
68
|
+
grpc_channel_stack_builder *b = gpr_zalloc(sizeof(*b));
|
70
69
|
|
71
70
|
b->begin.filter = NULL;
|
72
71
|
b->end.filter = NULL;
|
@@ -251,7 +250,7 @@ grpc_error *grpc_channel_stack_builder_finish(
|
|
251
250
|
size_t channel_stack_size = grpc_channel_stack_size(filters, num_filters);
|
252
251
|
|
253
252
|
// allocate memory, with prefix_bytes followed by channel_stack_size
|
254
|
-
*result =
|
253
|
+
*result = gpr_zalloc(prefix_bytes + channel_stack_size);
|
255
254
|
// fetch a pointer to the channel stack
|
256
255
|
grpc_channel_stack *channel_stack =
|
257
256
|
(grpc_channel_stack *)((char *)(*result) + prefix_bytes);
|
@@ -45,6 +45,7 @@
|
|
45
45
|
#include "src/core/lib/compression/message_compress.h"
|
46
46
|
#include "src/core/lib/profiling/timers.h"
|
47
47
|
#include "src/core/lib/slice/slice_internal.h"
|
48
|
+
#include "src/core/lib/slice/slice_string_helpers.h"
|
48
49
|
#include "src/core/lib/support/string.h"
|
49
50
|
#include "src/core/lib/transport/static_metadata.h"
|
50
51
|
|
@@ -80,39 +81,6 @@ typedef struct channel_data {
|
|
80
81
|
uint32_t supported_compression_algorithms;
|
81
82
|
} channel_data;
|
82
83
|
|
83
|
-
/** For each \a md element from the incoming metadata, filter out the entry for
|
84
|
-
* "grpc-encoding", using its value to populate the call data's
|
85
|
-
* compression_algorithm field. */
|
86
|
-
static grpc_mdelem *compression_md_filter(grpc_exec_ctx *exec_ctx,
|
87
|
-
void *user_data, grpc_mdelem *md) {
|
88
|
-
grpc_call_element *elem = user_data;
|
89
|
-
call_data *calld = elem->call_data;
|
90
|
-
channel_data *channeld = elem->channel_data;
|
91
|
-
|
92
|
-
if (md->key == GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST) {
|
93
|
-
const char *md_c_str = grpc_mdstr_as_c_string(md->value);
|
94
|
-
if (!grpc_compression_algorithm_parse(md_c_str, strlen(md_c_str),
|
95
|
-
&calld->compression_algorithm)) {
|
96
|
-
gpr_log(GPR_ERROR,
|
97
|
-
"Invalid compression algorithm: '%s' (unknown). Ignoring.",
|
98
|
-
md_c_str);
|
99
|
-
calld->compression_algorithm = GRPC_COMPRESS_NONE;
|
100
|
-
}
|
101
|
-
if (!GPR_BITGET(channeld->enabled_algorithms_bitset,
|
102
|
-
calld->compression_algorithm)) {
|
103
|
-
gpr_log(GPR_ERROR,
|
104
|
-
"Invalid compression algorithm: '%s' (previously disabled). "
|
105
|
-
"Ignoring.",
|
106
|
-
md_c_str);
|
107
|
-
calld->compression_algorithm = GRPC_COMPRESS_NONE;
|
108
|
-
}
|
109
|
-
calld->has_compression_algorithm = 1;
|
110
|
-
return NULL;
|
111
|
-
}
|
112
|
-
|
113
|
-
return md;
|
114
|
-
}
|
115
|
-
|
116
84
|
static int skip_compression(grpc_call_element *elem, uint32_t flags) {
|
117
85
|
call_data *calld = elem->call_data;
|
118
86
|
channel_data *channeld = elem->channel_data;
|
@@ -131,32 +99,67 @@ static int skip_compression(grpc_call_element *elem, uint32_t flags) {
|
|
131
99
|
}
|
132
100
|
|
133
101
|
/** Filter initial metadata */
|
134
|
-
static
|
102
|
+
static grpc_error *process_send_initial_metadata(
|
103
|
+
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
104
|
+
grpc_metadata_batch *initial_metadata) GRPC_MUST_USE_RESULT;
|
105
|
+
static grpc_error *process_send_initial_metadata(
|
135
106
|
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
136
107
|
grpc_metadata_batch *initial_metadata) {
|
137
108
|
call_data *calld = elem->call_data;
|
138
109
|
channel_data *channeld = elem->channel_data;
|
139
110
|
/* Parse incoming request for compression. If any, it'll be available
|
140
111
|
* at calld->compression_algorithm */
|
141
|
-
|
142
|
-
|
143
|
-
|
112
|
+
if (initial_metadata->idx.named.grpc_internal_encoding_request != NULL) {
|
113
|
+
grpc_mdelem md =
|
114
|
+
initial_metadata->idx.named.grpc_internal_encoding_request->md;
|
115
|
+
if (!grpc_compression_algorithm_parse(GRPC_MDVALUE(md),
|
116
|
+
&calld->compression_algorithm)) {
|
117
|
+
char *val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
|
118
|
+
gpr_log(GPR_ERROR,
|
119
|
+
"Invalid compression algorithm: '%s' (unknown). Ignoring.", val);
|
120
|
+
gpr_free(val);
|
121
|
+
calld->compression_algorithm = GRPC_COMPRESS_NONE;
|
122
|
+
}
|
123
|
+
if (!GPR_BITGET(channeld->enabled_algorithms_bitset,
|
124
|
+
calld->compression_algorithm)) {
|
125
|
+
char *val = grpc_slice_to_c_string(GRPC_MDVALUE(md));
|
126
|
+
gpr_log(GPR_ERROR,
|
127
|
+
"Invalid compression algorithm: '%s' (previously disabled). "
|
128
|
+
"Ignoring.",
|
129
|
+
val);
|
130
|
+
gpr_free(val);
|
131
|
+
calld->compression_algorithm = GRPC_COMPRESS_NONE;
|
132
|
+
}
|
133
|
+
calld->has_compression_algorithm = 1;
|
134
|
+
|
135
|
+
grpc_metadata_batch_remove(
|
136
|
+
exec_ctx, initial_metadata,
|
137
|
+
initial_metadata->idx.named.grpc_internal_encoding_request);
|
138
|
+
} else {
|
144
139
|
/* If no algorithm was found in the metadata and we aren't
|
145
140
|
* exceptionally skipping compression, fall back to the channel
|
146
141
|
* default */
|
147
142
|
calld->compression_algorithm = channeld->default_compression_algorithm;
|
148
143
|
calld->has_compression_algorithm = 1; /* GPR_TRUE */
|
149
144
|
}
|
145
|
+
|
146
|
+
grpc_error *error = GRPC_ERROR_NONE;
|
150
147
|
/* hint compression algorithm */
|
151
|
-
|
152
|
-
|
153
|
-
|
148
|
+
if (calld->compression_algorithm != GRPC_COMPRESS_NONE) {
|
149
|
+
error = grpc_metadata_batch_add_tail(
|
150
|
+
exec_ctx, initial_metadata, &calld->compression_algorithm_storage,
|
151
|
+
grpc_compression_encoding_mdelem(calld->compression_algorithm));
|
152
|
+
}
|
153
|
+
|
154
|
+
if (error != GRPC_ERROR_NONE) return error;
|
154
155
|
|
155
156
|
/* convey supported compression algorithms */
|
156
|
-
grpc_metadata_batch_add_tail(
|
157
|
-
|
158
|
-
|
159
|
-
|
157
|
+
error = grpc_metadata_batch_add_tail(
|
158
|
+
exec_ctx, initial_metadata, &calld->accept_encoding_storage,
|
159
|
+
GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(
|
160
|
+
channeld->supported_compression_algorithms));
|
161
|
+
|
162
|
+
return error;
|
160
163
|
}
|
161
164
|
|
162
165
|
static void continue_send_message(grpc_exec_ctx *exec_ctx,
|
@@ -247,7 +250,12 @@ static void compress_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
|
|
247
250
|
GPR_TIMER_BEGIN("compress_start_transport_stream_op", 0);
|
248
251
|
|
249
252
|
if (op->send_initial_metadata) {
|
250
|
-
process_send_initial_metadata(
|
253
|
+
grpc_error *error = process_send_initial_metadata(
|
254
|
+
exec_ctx, elem, op->send_initial_metadata);
|
255
|
+
if (error != GRPC_ERROR_NONE) {
|
256
|
+
grpc_transport_stream_op_finish_with_failure(exec_ctx, op, error);
|
257
|
+
return;
|
258
|
+
}
|
251
259
|
}
|
252
260
|
if (op->send_message != NULL &&
|
253
261
|
!skip_compression(elem, op->send_message->flags)) {
|
@@ -266,7 +274,7 @@ static void compress_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
|
|
266
274
|
/* Constructor for call_data */
|
267
275
|
static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
|
268
276
|
grpc_call_element *elem,
|
269
|
-
grpc_call_element_args *args) {
|
277
|
+
const grpc_call_element_args *args) {
|
270
278
|
/* grab pointers to our data from the call element */
|
271
279
|
call_data *calld = elem->call_data;
|
272
280
|
|
@@ -83,7 +83,7 @@ static void con_start_transport_op(grpc_exec_ctx *exec_ctx,
|
|
83
83
|
/* Constructor for call_data */
|
84
84
|
static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
|
85
85
|
grpc_call_element *elem,
|
86
|
-
grpc_call_element_args *args) {
|
86
|
+
const grpc_call_element_args *args) {
|
87
87
|
call_data *calld = elem->call_data;
|
88
88
|
channel_data *chand = elem->channel_data;
|
89
89
|
int r = grpc_transport_init_stream(
|
@@ -140,7 +140,7 @@ static void con_get_channel_info(grpc_exec_ctx *exec_ctx,
|
|
140
140
|
grpc_channel_element *elem,
|
141
141
|
const grpc_channel_info *channel_info) {}
|
142
142
|
|
143
|
-
|
143
|
+
const grpc_channel_filter grpc_connected_filter = {
|
144
144
|
con_start_transport_stream_op,
|
145
145
|
con_start_transport_op,
|
146
146
|
sizeof(call_data),
|
@@ -158,7 +158,7 @@ static const grpc_channel_filter connected_channel_filter = {
|
|
158
158
|
static void bind_transport(grpc_channel_stack *channel_stack,
|
159
159
|
grpc_channel_element *elem, void *t) {
|
160
160
|
channel_data *cd = (channel_data *)elem->channel_data;
|
161
|
-
GPR_ASSERT(elem->filter == &
|
161
|
+
GPR_ASSERT(elem->filter == &grpc_connected_filter);
|
162
162
|
GPR_ASSERT(cd->transport == NULL);
|
163
163
|
cd->transport = t;
|
164
164
|
|
@@ -178,7 +178,7 @@ bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx,
|
|
178
178
|
grpc_transport *t = grpc_channel_stack_builder_get_transport(builder);
|
179
179
|
GPR_ASSERT(t != NULL);
|
180
180
|
return grpc_channel_stack_builder_append_filter(
|
181
|
-
builder, &
|
181
|
+
builder, &grpc_connected_filter, bind_transport, t);
|
182
182
|
}
|
183
183
|
|
184
184
|
grpc_stream *grpc_connected_channel_get_stream(grpc_call_element *elem) {
|
@@ -36,8 +36,13 @@
|
|
36
36
|
|
37
37
|
#include "src/core/lib/channel/channel_stack_builder.h"
|
38
38
|
|
39
|
+
extern const grpc_channel_filter grpc_connected_filter;
|
40
|
+
|
39
41
|
bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx,
|
40
42
|
grpc_channel_stack_builder *builder,
|
41
43
|
void *arg_must_be_null);
|
42
44
|
|
45
|
+
/* Debug helper to dig the transport stream out of a call element */
|
46
|
+
grpc_stream *grpc_connected_channel_get_stream(grpc_call_element *elem);
|
47
|
+
|
43
48
|
#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */
|
@@ -52,66 +52,75 @@ static void timer_callback(grpc_exec_ctx* exec_ctx, void* arg,
|
|
52
52
|
grpc_error* error) {
|
53
53
|
grpc_call_element* elem = arg;
|
54
54
|
grpc_deadline_state* deadline_state = elem->call_data;
|
55
|
-
gpr_mu_lock(&deadline_state->timer_mu);
|
56
|
-
deadline_state->timer_pending = false;
|
57
|
-
gpr_mu_unlock(&deadline_state->timer_mu);
|
58
55
|
if (error != GRPC_ERROR_CANCELLED) {
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
56
|
+
grpc_call_element_signal_error(
|
57
|
+
exec_ctx, elem,
|
58
|
+
grpc_error_set_int(GRPC_ERROR_CREATE("Deadline Exceeded"),
|
59
|
+
GRPC_ERROR_INT_GRPC_STATUS,
|
60
|
+
GRPC_STATUS_DEADLINE_EXCEEDED));
|
63
61
|
}
|
64
62
|
GRPC_CALL_STACK_UNREF(exec_ctx, deadline_state->call_stack, "deadline_timer");
|
65
63
|
}
|
66
64
|
|
67
65
|
// Starts the deadline timer.
|
68
|
-
static void start_timer_if_needed_locked(grpc_exec_ctx* exec_ctx,
|
69
|
-
grpc_call_element* elem,
|
70
|
-
gpr_timespec deadline) {
|
71
|
-
grpc_deadline_state* deadline_state = elem->call_data;
|
72
|
-
deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
|
73
|
-
// Note: We do not start the timer if there is already a timer
|
74
|
-
// pending. This should be okay, because this is only called from two
|
75
|
-
// functions exported by this module: grpc_deadline_state_start(), which
|
76
|
-
// starts the initial timer, and grpc_deadline_state_reset(), which
|
77
|
-
// cancels any pre-existing timer before starting a new one. In
|
78
|
-
// particular, we want to ensure that if grpc_deadline_state_start()
|
79
|
-
// winds up trying to start the timer after grpc_deadline_state_reset()
|
80
|
-
// has already done so, we ignore the value from the former.
|
81
|
-
if (!deadline_state->timer_pending &&
|
82
|
-
gpr_time_cmp(deadline, gpr_inf_future(GPR_CLOCK_MONOTONIC)) != 0) {
|
83
|
-
// Take a reference to the call stack, to be owned by the timer.
|
84
|
-
GRPC_CALL_STACK_REF(deadline_state->call_stack, "deadline_timer");
|
85
|
-
deadline_state->timer_pending = true;
|
86
|
-
grpc_closure_init(&deadline_state->timer_callback, timer_callback, elem,
|
87
|
-
grpc_schedule_on_exec_ctx);
|
88
|
-
grpc_timer_init(exec_ctx, &deadline_state->timer, deadline,
|
89
|
-
&deadline_state->timer_callback,
|
90
|
-
gpr_now(GPR_CLOCK_MONOTONIC));
|
91
|
-
}
|
92
|
-
}
|
93
66
|
static void start_timer_if_needed(grpc_exec_ctx* exec_ctx,
|
94
67
|
grpc_call_element* elem,
|
95
68
|
gpr_timespec deadline) {
|
69
|
+
deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
|
70
|
+
if (gpr_time_cmp(deadline, gpr_inf_future(GPR_CLOCK_MONOTONIC)) == 0) {
|
71
|
+
return;
|
72
|
+
}
|
96
73
|
grpc_deadline_state* deadline_state = elem->call_data;
|
97
|
-
|
98
|
-
|
99
|
-
|
74
|
+
grpc_deadline_timer_state cur_state;
|
75
|
+
grpc_closure* closure = NULL;
|
76
|
+
retry:
|
77
|
+
cur_state =
|
78
|
+
(grpc_deadline_timer_state)gpr_atm_acq_load(&deadline_state->timer_state);
|
79
|
+
switch (cur_state) {
|
80
|
+
case GRPC_DEADLINE_STATE_PENDING:
|
81
|
+
// Note: We do not start the timer if there is already a timer
|
82
|
+
return;
|
83
|
+
case GRPC_DEADLINE_STATE_FINISHED:
|
84
|
+
if (gpr_atm_rel_cas(&deadline_state->timer_state,
|
85
|
+
GRPC_DEADLINE_STATE_FINISHED,
|
86
|
+
GRPC_DEADLINE_STATE_PENDING)) {
|
87
|
+
// If we've already created and destroyed a timer, we always create a
|
88
|
+
// new closure: we have no other guarantee that the inlined closure is
|
89
|
+
// not in use (it may hold a pending call to timer_callback)
|
90
|
+
closure = grpc_closure_create(timer_callback, elem,
|
91
|
+
grpc_schedule_on_exec_ctx);
|
92
|
+
} else {
|
93
|
+
goto retry;
|
94
|
+
}
|
95
|
+
break;
|
96
|
+
case GRPC_DEADLINE_STATE_INITIAL:
|
97
|
+
if (gpr_atm_rel_cas(&deadline_state->timer_state,
|
98
|
+
GRPC_DEADLINE_STATE_INITIAL,
|
99
|
+
GRPC_DEADLINE_STATE_PENDING)) {
|
100
|
+
closure =
|
101
|
+
grpc_closure_init(&deadline_state->timer_callback, timer_callback,
|
102
|
+
elem, grpc_schedule_on_exec_ctx);
|
103
|
+
} else {
|
104
|
+
goto retry;
|
105
|
+
}
|
106
|
+
break;
|
107
|
+
}
|
108
|
+
GPR_ASSERT(closure);
|
109
|
+
GRPC_CALL_STACK_REF(deadline_state->call_stack, "deadline_timer");
|
110
|
+
grpc_timer_init(exec_ctx, &deadline_state->timer, deadline, closure,
|
111
|
+
gpr_now(GPR_CLOCK_MONOTONIC));
|
100
112
|
}
|
101
113
|
|
102
114
|
// Cancels the deadline timer.
|
103
|
-
static void cancel_timer_if_needed_locked(grpc_exec_ctx* exec_ctx,
|
104
|
-
grpc_deadline_state* deadline_state) {
|
105
|
-
if (deadline_state->timer_pending) {
|
106
|
-
grpc_timer_cancel(exec_ctx, &deadline_state->timer);
|
107
|
-
deadline_state->timer_pending = false;
|
108
|
-
}
|
109
|
-
}
|
110
115
|
static void cancel_timer_if_needed(grpc_exec_ctx* exec_ctx,
|
111
116
|
grpc_deadline_state* deadline_state) {
|
112
|
-
|
113
|
-
|
114
|
-
|
117
|
+
if (gpr_atm_rel_cas(&deadline_state->timer_state, GRPC_DEADLINE_STATE_PENDING,
|
118
|
+
GRPC_DEADLINE_STATE_FINISHED)) {
|
119
|
+
grpc_timer_cancel(exec_ctx, &deadline_state->timer);
|
120
|
+
} else {
|
121
|
+
// timer was either in STATE_INITAL (nothing to cancel)
|
122
|
+
// OR in STATE_FINISHED (again nothing to cancel)
|
123
|
+
}
|
115
124
|
}
|
116
125
|
|
117
126
|
// Callback run when the call is complete.
|
@@ -119,8 +128,8 @@ static void on_complete(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
|
|
119
128
|
grpc_deadline_state* deadline_state = arg;
|
120
129
|
cancel_timer_if_needed(exec_ctx, deadline_state);
|
121
130
|
// Invoke the next callback.
|
122
|
-
deadline_state->next_on_complete
|
123
|
-
|
131
|
+
grpc_closure_run(exec_ctx, deadline_state->next_on_complete,
|
132
|
+
GRPC_ERROR_REF(error));
|
124
133
|
}
|
125
134
|
|
126
135
|
// Inject our own on_complete callback into op.
|
@@ -135,16 +144,13 @@ static void inject_on_complete_cb(grpc_deadline_state* deadline_state,
|
|
135
144
|
void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
136
145
|
grpc_call_stack* call_stack) {
|
137
146
|
grpc_deadline_state* deadline_state = elem->call_data;
|
138
|
-
memset(deadline_state, 0, sizeof(*deadline_state));
|
139
147
|
deadline_state->call_stack = call_stack;
|
140
|
-
gpr_mu_init(&deadline_state->timer_mu);
|
141
148
|
}
|
142
149
|
|
143
150
|
void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx,
|
144
151
|
grpc_call_element* elem) {
|
145
152
|
grpc_deadline_state* deadline_state = elem->call_data;
|
146
153
|
cancel_timer_if_needed(exec_ctx, deadline_state);
|
147
|
-
gpr_mu_destroy(&deadline_state->timer_mu);
|
148
154
|
}
|
149
155
|
|
150
156
|
// Callback and associated state for starting the timer after call stack
|
@@ -186,18 +192,15 @@ void grpc_deadline_state_start(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
|
186
192
|
void grpc_deadline_state_reset(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
187
193
|
gpr_timespec new_deadline) {
|
188
194
|
grpc_deadline_state* deadline_state = elem->call_data;
|
189
|
-
|
190
|
-
|
191
|
-
start_timer_if_needed_locked(exec_ctx, elem, new_deadline);
|
192
|
-
gpr_mu_unlock(&deadline_state->timer_mu);
|
195
|
+
cancel_timer_if_needed(exec_ctx, deadline_state);
|
196
|
+
start_timer_if_needed(exec_ctx, elem, new_deadline);
|
193
197
|
}
|
194
198
|
|
195
199
|
void grpc_deadline_state_client_start_transport_stream_op(
|
196
200
|
grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
197
201
|
grpc_transport_stream_op* op) {
|
198
202
|
grpc_deadline_state* deadline_state = elem->call_data;
|
199
|
-
if (op->cancel_error != GRPC_ERROR_NONE
|
200
|
-
op->close_error != GRPC_ERROR_NONE) {
|
203
|
+
if (op->cancel_error != GRPC_ERROR_NONE) {
|
201
204
|
cancel_timer_if_needed(exec_ctx, deadline_state);
|
202
205
|
} else {
|
203
206
|
// Make sure we know when the call is complete, so that we can cancel
|
@@ -244,9 +247,7 @@ typedef struct server_call_data {
|
|
244
247
|
// Constructor for call_data. Used for both client and server filters.
|
245
248
|
static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
|
246
249
|
grpc_call_element* elem,
|
247
|
-
grpc_call_element_args* args) {
|
248
|
-
// Note: size of call data is different between client and server.
|
249
|
-
memset(elem->call_data, 0, elem->filter->sizeof_call_data);
|
250
|
+
const grpc_call_element_args* args) {
|
250
251
|
grpc_deadline_state_init(exec_ctx, elem, args->call_stack);
|
251
252
|
grpc_deadline_state_start(exec_ctx, elem, args->deadline);
|
252
253
|
return GRPC_ERROR_NONE;
|
@@ -285,8 +286,7 @@ static void server_start_transport_stream_op(grpc_exec_ctx* exec_ctx,
|
|
285
286
|
grpc_call_element* elem,
|
286
287
|
grpc_transport_stream_op* op) {
|
287
288
|
server_call_data* calld = elem->call_data;
|
288
|
-
if (op->cancel_error != GRPC_ERROR_NONE
|
289
|
-
op->close_error != GRPC_ERROR_NONE) {
|
289
|
+
if (op->cancel_error != GRPC_ERROR_NONE) {
|
290
290
|
cancel_timer_if_needed(exec_ctx, &calld->base.deadline_state);
|
291
291
|
} else {
|
292
292
|
// If we're receiving initial metadata, we need to get the deadline
|