wearefair-grpc 1.3.1.pre.c → 1.4.0.fair
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +418 -126
- data/include/grpc/grpc.h +15 -69
- data/include/grpc/grpc_security.h +1 -1
- data/include/grpc/impl/codegen/compression_types.h +3 -4
- data/include/grpc/impl/codegen/gpr_types.h +0 -1
- data/include/grpc/impl/codegen/grpc_types.h +69 -3
- data/include/grpc/impl/codegen/port_platform.h +6 -0
- data/include/grpc/impl/codegen/slice.h +2 -1
- data/include/grpc/load_reporting.h +6 -6
- data/include/grpc/slice.h +25 -3
- data/include/grpc/slice_buffer.h +4 -0
- data/src/core/ext/census/context.c +1 -1
- data/src/core/ext/census/resource.c +3 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
- data/src/core/ext/filters/client_channel/client_channel.c +158 -100
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
- data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +5 -6
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +344 -88
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +47 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +6 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +13 -12
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
- data/src/core/ext/filters/client_channel/parse_address.c +37 -7
- data/src/core/ext/filters/client_channel/parse_address.h +11 -8
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/filters/client_channel/subchannel.c +19 -16
- data/src/core/ext/filters/client_channel/subchannel.h +1 -0
- data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
- data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
- data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
- data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
- data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
- data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +296 -172
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
- data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
- data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
- data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
- data/src/core/lib/channel/channel_args.c +28 -9
- data/src/core/lib/channel/channel_args.h +5 -1
- data/src/core/lib/channel/channel_stack.c +1 -1
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.c +13 -1
- data/src/core/lib/channel/channel_stack_builder.h +5 -1
- data/src/core/lib/channel/connected_channel.c +3 -1
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/compression/message_compress.c +2 -2
- data/src/core/lib/debug/trace.c +13 -6
- data/src/core/lib/debug/trace.h +27 -1
- data/src/core/lib/http/httpcli.c +1 -1
- data/src/core/lib/http/httpcli_security_connector.c +6 -10
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/combiner.c +6 -6
- data/src/core/lib/iomgr/combiner.h +2 -1
- data/src/core/lib/iomgr/error.c +12 -5
- data/src/core/lib/iomgr/error.h +13 -13
- data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
- data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +24 -31
- data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
- data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
- data/src/core/lib/iomgr/ev_posix.c +22 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -3
- data/src/core/lib/iomgr/exec_ctx.c +5 -0
- data/src/core/lib/iomgr/exec_ctx.h +2 -0
- data/src/core/lib/iomgr/iomgr.c +4 -0
- data/src/core/lib/iomgr/iomgr.h +3 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
- data/src/core/lib/iomgr/lockfree_event.c +16 -0
- data/src/core/lib/iomgr/pollset.h +2 -5
- data/src/core/lib/iomgr/pollset_uv.c +1 -1
- data/src/core/lib/iomgr/pollset_windows.c +3 -3
- data/src/core/lib/iomgr/resource_quota.c +9 -8
- data/src/core/lib/iomgr/resource_quota.h +2 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
- data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
- data/src/core/lib/iomgr/tcp_posix.c +7 -7
- data/src/core/lib/iomgr/tcp_posix.h +2 -1
- data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +6 -6
- data/src/core/lib/iomgr/tcp_uv.h +2 -1
- data/src/core/lib/iomgr/tcp_windows.c +1 -1
- data/src/core/lib/iomgr/timer_generic.c +24 -25
- data/src/core/lib/iomgr/timer_manager.c +276 -0
- data/src/core/lib/iomgr/timer_manager.h +52 -0
- data/src/core/lib/iomgr/timer_uv.c +6 -0
- data/src/core/lib/iomgr/udp_server.c +42 -9
- data/src/core/lib/iomgr/udp_server.h +3 -1
- data/src/core/lib/security/credentials/credentials.c +0 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
- data/src/core/lib/security/transport/client_auth_filter.c +9 -3
- data/src/core/lib/security/transport/secure_endpoint.c +7 -7
- data/src/core/lib/security/transport/secure_endpoint.h +1 -1
- data/src/core/lib/security/transport/security_connector.c +32 -51
- data/src/core/lib/security/transport/security_connector.h +10 -14
- data/src/core/lib/slice/b64.c +1 -1
- data/src/core/lib/slice/percent_encoding.c +3 -3
- data/src/core/lib/slice/slice.c +66 -33
- data/src/core/lib/slice/slice_buffer.c +25 -6
- data/src/core/lib/slice/slice_hash_table.c +33 -35
- data/src/core/lib/slice/slice_hash_table.h +7 -12
- data/src/core/lib/support/atomic.h +45 -0
- data/src/core/lib/support/atomic_with_atm.h +70 -0
- data/src/core/lib/support/atomic_with_std.h +48 -0
- data/src/core/lib/support/avl.c +14 -14
- data/src/core/lib/support/memory.h +74 -0
- data/src/core/lib/support/mpscq.c +12 -1
- data/src/core/lib/support/mpscq.h +4 -0
- data/src/core/lib/support/stack_lockfree.c +3 -36
- data/src/core/lib/support/time_posix.c +8 -0
- data/src/core/lib/support/tmpfile_posix.c +10 -10
- data/src/core/lib/surface/alarm.c +3 -1
- data/src/core/lib/surface/api_trace.c +2 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +1 -1
- data/src/core/lib/surface/call.c +65 -22
- data/src/core/lib/surface/call.h +4 -2
- data/src/core/lib/surface/channel_init.c +2 -19
- data/src/core/lib/surface/channel_stack_type.c +18 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.c +249 -83
- data/src/core/lib/surface/completion_queue.h +18 -13
- data/src/core/lib/surface/completion_queue_factory.c +24 -9
- data/src/core/lib/surface/init.c +1 -52
- data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
- data/src/core/lib/surface/server.c +50 -27
- data/src/core/lib/surface/server.h +2 -1
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +20 -9
- data/src/core/lib/transport/bdp_estimator.h +5 -1
- data/src/core/lib/transport/byte_stream.c +23 -9
- data/src/core/lib/transport/byte_stream.h +15 -6
- data/src/core/lib/transport/connectivity_state.c +6 -6
- data/src/core/lib/transport/connectivity_state.h +2 -1
- data/src/core/lib/transport/service_config.c +6 -13
- data/src/core/lib/transport/service_config.h +2 -2
- data/src/core/lib/transport/static_metadata.c +403 -389
- data/src/core/lib/transport/static_metadata.h +127 -114
- data/src/core/plugin_registry/grpc_plugin_registry.c +12 -0
- data/src/core/tsi/fake_transport_security.c +5 -4
- data/src/core/tsi/ssl_transport_security.c +71 -82
- data/src/core/tsi/ssl_transport_security.h +39 -61
- data/src/core/tsi/transport_security.c +83 -2
- data/src/core/tsi/transport_security.h +27 -2
- data/src/core/tsi/transport_security_adapter.c +236 -0
- data/src/core/tsi/transport_security_adapter.h +62 -0
- data/src/core/tsi/transport_security_interface.h +179 -66
- data/src/ruby/ext/grpc/extconf.rb +2 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
- data/src/ruby/ext/grpc/rb_call.c +56 -48
- data/src/ruby/ext/grpc/rb_call.h +3 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
- data/src/ruby/ext/grpc/rb_channel.c +45 -29
- data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
- data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
- data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
- data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
- data/src/ruby/ext/grpc/rb_grpc.c +11 -15
- data/src/ruby/ext/grpc/rb_grpc.h +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +14 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +22 -10
- data/src/ruby/ext/grpc/rb_server.c +26 -28
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +40 -18
- data/src/ruby/lib/grpc/grpc_c.bundle +0 -0
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
data/src/core/lib/surface/call.h
CHANGED
@@ -117,7 +117,8 @@ void grpc_call_context_set(grpc_call *call, grpc_context_index elem,
|
|
117
117
|
void *grpc_call_context_get(grpc_call *call, grpc_context_index elem);
|
118
118
|
|
119
119
|
#define GRPC_CALL_LOG_BATCH(sev, call, ops, nops, tag) \
|
120
|
-
if (grpc_api_trace)
|
120
|
+
if (GRPC_TRACER_ON(grpc_api_trace)) \
|
121
|
+
grpc_call_log_batch(sev, call, ops, nops, tag)
|
121
122
|
|
122
123
|
uint8_t grpc_call_is_client(grpc_call *call);
|
123
124
|
|
@@ -126,7 +127,8 @@ uint8_t grpc_call_is_client(grpc_call *call);
|
|
126
127
|
grpc_compression_algorithm grpc_call_compression_for_level(
|
127
128
|
grpc_call *call, grpc_compression_level level);
|
128
129
|
|
129
|
-
extern
|
130
|
+
extern grpc_tracer_flag grpc_call_error_trace;
|
131
|
+
extern grpc_tracer_flag grpc_compression_trace;
|
130
132
|
|
131
133
|
#ifdef __cplusplus
|
132
134
|
}
|
@@ -104,30 +104,13 @@ void grpc_channel_init_shutdown(void) {
|
|
104
104
|
}
|
105
105
|
}
|
106
106
|
|
107
|
-
static const char *name_for_type(grpc_channel_stack_type type) {
|
108
|
-
switch (type) {
|
109
|
-
case GRPC_CLIENT_CHANNEL:
|
110
|
-
return "CLIENT_CHANNEL";
|
111
|
-
case GRPC_CLIENT_SUBCHANNEL:
|
112
|
-
return "CLIENT_SUBCHANNEL";
|
113
|
-
case GRPC_SERVER_CHANNEL:
|
114
|
-
return "SERVER_CHANNEL";
|
115
|
-
case GRPC_CLIENT_LAME_CHANNEL:
|
116
|
-
return "CLIENT_LAME_CHANNEL";
|
117
|
-
case GRPC_CLIENT_DIRECT_CHANNEL:
|
118
|
-
return "CLIENT_DIRECT_CHANNEL";
|
119
|
-
case GRPC_NUM_CHANNEL_STACK_TYPES:
|
120
|
-
break;
|
121
|
-
}
|
122
|
-
GPR_UNREACHABLE_CODE(return "UNKNOWN");
|
123
|
-
}
|
124
|
-
|
125
107
|
bool grpc_channel_init_create_stack(grpc_exec_ctx *exec_ctx,
|
126
108
|
grpc_channel_stack_builder *builder,
|
127
109
|
grpc_channel_stack_type type) {
|
128
110
|
GPR_ASSERT(g_finalized);
|
129
111
|
|
130
|
-
grpc_channel_stack_builder_set_name(builder,
|
112
|
+
grpc_channel_stack_builder_set_name(builder,
|
113
|
+
grpc_channel_stack_type_string(type));
|
131
114
|
|
132
115
|
for (size_t i = 0; i < g_slots[type].num_slots; i++) {
|
133
116
|
const stage_slot *slot = &g_slots[type].slots[i];
|
@@ -52,3 +52,21 @@ bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type) {
|
|
52
52
|
}
|
53
53
|
GPR_UNREACHABLE_CODE(return true;);
|
54
54
|
}
|
55
|
+
|
56
|
+
const char *grpc_channel_stack_type_string(grpc_channel_stack_type type) {
|
57
|
+
switch (type) {
|
58
|
+
case GRPC_CLIENT_CHANNEL:
|
59
|
+
return "CLIENT_CHANNEL";
|
60
|
+
case GRPC_CLIENT_SUBCHANNEL:
|
61
|
+
return "CLIENT_SUBCHANNEL";
|
62
|
+
case GRPC_SERVER_CHANNEL:
|
63
|
+
return "SERVER_CHANNEL";
|
64
|
+
case GRPC_CLIENT_LAME_CHANNEL:
|
65
|
+
return "CLIENT_LAME_CHANNEL";
|
66
|
+
case GRPC_CLIENT_DIRECT_CHANNEL:
|
67
|
+
return "CLIENT_DIRECT_CHANNEL";
|
68
|
+
case GRPC_NUM_CHANNEL_STACK_TYPES:
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
GPR_UNREACHABLE_CODE(return "UNKNOWN");
|
72
|
+
}
|
@@ -50,9 +50,9 @@
|
|
50
50
|
#include "src/core/lib/surface/call.h"
|
51
51
|
#include "src/core/lib/surface/event_string.h"
|
52
52
|
|
53
|
-
|
53
|
+
grpc_tracer_flag grpc_trace_operation_failures = GRPC_TRACER_INITIALIZER(false);
|
54
54
|
#ifndef NDEBUG
|
55
|
-
|
55
|
+
grpc_tracer_flag grpc_trace_pending_tags = GRPC_TRACER_INITIALIZER(false);
|
56
56
|
#endif
|
57
57
|
|
58
58
|
typedef struct {
|
@@ -60,10 +60,156 @@ typedef struct {
|
|
60
60
|
void *tag;
|
61
61
|
} plucker;
|
62
62
|
|
63
|
+
typedef struct {
|
64
|
+
bool can_get_pollset;
|
65
|
+
bool can_listen;
|
66
|
+
size_t (*size)(void);
|
67
|
+
void (*init)(grpc_pollset *pollset, gpr_mu **mu);
|
68
|
+
grpc_error *(*kick)(grpc_pollset *pollset,
|
69
|
+
grpc_pollset_worker *specific_worker);
|
70
|
+
grpc_error *(*work)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
71
|
+
grpc_pollset_worker **worker, gpr_timespec now,
|
72
|
+
gpr_timespec deadline);
|
73
|
+
void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
|
74
|
+
grpc_closure *closure);
|
75
|
+
void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset);
|
76
|
+
} cq_poller_vtable;
|
77
|
+
|
78
|
+
typedef struct non_polling_worker {
|
79
|
+
gpr_cv cv;
|
80
|
+
bool kicked;
|
81
|
+
struct non_polling_worker *next;
|
82
|
+
struct non_polling_worker *prev;
|
83
|
+
} non_polling_worker;
|
84
|
+
|
85
|
+
typedef struct {
|
86
|
+
gpr_mu mu;
|
87
|
+
non_polling_worker *root;
|
88
|
+
grpc_closure *shutdown;
|
89
|
+
} non_polling_poller;
|
90
|
+
|
91
|
+
static size_t non_polling_poller_size(void) {
|
92
|
+
return sizeof(non_polling_poller);
|
93
|
+
}
|
94
|
+
|
95
|
+
static void non_polling_poller_init(grpc_pollset *pollset, gpr_mu **mu) {
|
96
|
+
non_polling_poller *npp = (non_polling_poller *)pollset;
|
97
|
+
gpr_mu_init(&npp->mu);
|
98
|
+
*mu = &npp->mu;
|
99
|
+
}
|
100
|
+
|
101
|
+
static void non_polling_poller_destroy(grpc_exec_ctx *exec_ctx,
|
102
|
+
grpc_pollset *pollset) {
|
103
|
+
non_polling_poller *npp = (non_polling_poller *)pollset;
|
104
|
+
gpr_mu_destroy(&npp->mu);
|
105
|
+
}
|
106
|
+
|
107
|
+
static grpc_error *non_polling_poller_work(grpc_exec_ctx *exec_ctx,
|
108
|
+
grpc_pollset *pollset,
|
109
|
+
grpc_pollset_worker **worker,
|
110
|
+
gpr_timespec now,
|
111
|
+
gpr_timespec deadline) {
|
112
|
+
non_polling_poller *npp = (non_polling_poller *)pollset;
|
113
|
+
if (npp->shutdown) return GRPC_ERROR_NONE;
|
114
|
+
non_polling_worker w;
|
115
|
+
gpr_cv_init(&w.cv);
|
116
|
+
if (worker != NULL) *worker = (grpc_pollset_worker *)&w;
|
117
|
+
if (npp->root == NULL) {
|
118
|
+
npp->root = w.next = w.prev = &w;
|
119
|
+
} else {
|
120
|
+
w.next = npp->root;
|
121
|
+
w.prev = w.next->prev;
|
122
|
+
w.next->prev = w.prev->next = &w;
|
123
|
+
}
|
124
|
+
w.kicked = false;
|
125
|
+
while (!npp->shutdown && !w.kicked && !gpr_cv_wait(&w.cv, &npp->mu, deadline))
|
126
|
+
;
|
127
|
+
if (&w == npp->root) {
|
128
|
+
npp->root = w.next;
|
129
|
+
if (&w == npp->root) {
|
130
|
+
if (npp->shutdown) {
|
131
|
+
grpc_closure_sched(exec_ctx, npp->shutdown, GRPC_ERROR_NONE);
|
132
|
+
}
|
133
|
+
npp->root = NULL;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
w.next->prev = w.prev;
|
137
|
+
w.prev->next = w.next;
|
138
|
+
gpr_cv_destroy(&w.cv);
|
139
|
+
if (worker != NULL) *worker = NULL;
|
140
|
+
return GRPC_ERROR_NONE;
|
141
|
+
}
|
142
|
+
|
143
|
+
static grpc_error *non_polling_poller_kick(
|
144
|
+
grpc_pollset *pollset, grpc_pollset_worker *specific_worker) {
|
145
|
+
non_polling_poller *p = (non_polling_poller *)pollset;
|
146
|
+
if (specific_worker == NULL) specific_worker = (grpc_pollset_worker *)p->root;
|
147
|
+
if (specific_worker != NULL) {
|
148
|
+
non_polling_worker *w = (non_polling_worker *)specific_worker;
|
149
|
+
if (!w->kicked) {
|
150
|
+
w->kicked = true;
|
151
|
+
gpr_cv_signal(&w->cv);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
return GRPC_ERROR_NONE;
|
155
|
+
}
|
156
|
+
|
157
|
+
static void non_polling_poller_shutdown(grpc_exec_ctx *exec_ctx,
|
158
|
+
grpc_pollset *pollset,
|
159
|
+
grpc_closure *closure) {
|
160
|
+
non_polling_poller *p = (non_polling_poller *)pollset;
|
161
|
+
GPR_ASSERT(closure != NULL);
|
162
|
+
p->shutdown = closure;
|
163
|
+
if (p->root == NULL) {
|
164
|
+
grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE);
|
165
|
+
} else {
|
166
|
+
non_polling_worker *w = p->root;
|
167
|
+
do {
|
168
|
+
gpr_cv_signal(&w->cv);
|
169
|
+
w = w->next;
|
170
|
+
} while (w != p->root);
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
static const cq_poller_vtable g_poller_vtable_by_poller_type[] = {
|
175
|
+
/* GRPC_CQ_DEFAULT_POLLING */
|
176
|
+
{.can_get_pollset = true,
|
177
|
+
.can_listen = true,
|
178
|
+
.size = grpc_pollset_size,
|
179
|
+
.init = grpc_pollset_init,
|
180
|
+
.kick = grpc_pollset_kick,
|
181
|
+
.work = grpc_pollset_work,
|
182
|
+
.shutdown = grpc_pollset_shutdown,
|
183
|
+
.destroy = grpc_pollset_destroy},
|
184
|
+
/* GRPC_CQ_NON_LISTENING */
|
185
|
+
{.can_get_pollset = true,
|
186
|
+
.can_listen = false,
|
187
|
+
.size = grpc_pollset_size,
|
188
|
+
.init = grpc_pollset_init,
|
189
|
+
.kick = grpc_pollset_kick,
|
190
|
+
.work = grpc_pollset_work,
|
191
|
+
.shutdown = grpc_pollset_shutdown,
|
192
|
+
.destroy = grpc_pollset_destroy},
|
193
|
+
/* GRPC_CQ_NON_POLLING */
|
194
|
+
{.can_get_pollset = false,
|
195
|
+
.can_listen = false,
|
196
|
+
.size = non_polling_poller_size,
|
197
|
+
.init = non_polling_poller_init,
|
198
|
+
.kick = non_polling_poller_kick,
|
199
|
+
.work = non_polling_poller_work,
|
200
|
+
.shutdown = non_polling_poller_shutdown,
|
201
|
+
.destroy = non_polling_poller_destroy},
|
202
|
+
};
|
203
|
+
|
63
204
|
/* Completion queue structure */
|
64
205
|
struct grpc_completion_queue {
|
65
206
|
/** owned by pollset */
|
66
207
|
gpr_mu *mu;
|
208
|
+
|
209
|
+
grpc_cq_completion_type completion_type;
|
210
|
+
|
211
|
+
const cq_poller_vtable *poller_vtable;
|
212
|
+
|
67
213
|
/** completed events */
|
68
214
|
grpc_cq_completion completed_head;
|
69
215
|
grpc_cq_completion *completed_tail;
|
@@ -79,6 +225,7 @@ struct grpc_completion_queue {
|
|
79
225
|
int shutdown_called;
|
80
226
|
int is_server_cq;
|
81
227
|
/** Can the server cq accept incoming channels */
|
228
|
+
/* TODO: sreek - This will no longer be needed. Use polling_type set */
|
82
229
|
int is_non_listening_server_cq;
|
83
230
|
int num_pluckers;
|
84
231
|
plucker pluckers[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS];
|
@@ -96,35 +243,46 @@ struct grpc_completion_queue {
|
|
96
243
|
#define POLLSET_FROM_CQ(cq) ((grpc_pollset *)(cq + 1))
|
97
244
|
#define CQ_FROM_POLLSET(ps) (((grpc_completion_queue *)ps) - 1)
|
98
245
|
|
99
|
-
|
100
|
-
|
246
|
+
grpc_tracer_flag grpc_cq_pluck_trace = GRPC_TRACER_INITIALIZER(true);
|
247
|
+
grpc_tracer_flag grpc_cq_event_timeout_trace = GRPC_TRACER_INITIALIZER(true);
|
101
248
|
|
102
|
-
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event)
|
103
|
-
if (grpc_api_trace &&
|
104
|
-
(grpc_cq_pluck_trace ||
|
105
|
-
|
106
|
-
|
107
|
-
|
249
|
+
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
|
250
|
+
if (GRPC_TRACER_ON(grpc_api_trace) && \
|
251
|
+
(GRPC_TRACER_ON(grpc_cq_pluck_trace) || \
|
252
|
+
(event)->type != GRPC_QUEUE_TIMEOUT)) { \
|
253
|
+
char *_ev = grpc_event_string(event); \
|
254
|
+
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
|
255
|
+
gpr_free(_ev); \
|
108
256
|
}
|
109
257
|
|
110
258
|
static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *cc,
|
111
259
|
grpc_error *error);
|
112
260
|
|
113
|
-
grpc_completion_queue *
|
261
|
+
grpc_completion_queue *grpc_completion_queue_create_internal(
|
262
|
+
grpc_cq_completion_type completion_type,
|
263
|
+
grpc_cq_polling_type polling_type) {
|
114
264
|
grpc_completion_queue *cc;
|
115
|
-
GPR_ASSERT(!reserved);
|
116
265
|
|
117
|
-
GPR_TIMER_BEGIN("
|
266
|
+
GPR_TIMER_BEGIN("grpc_completion_queue_create_internal", 0);
|
267
|
+
|
268
|
+
GRPC_API_TRACE(
|
269
|
+
"grpc_completion_queue_create_internal(completion_type=%d, "
|
270
|
+
"polling_type=%d)",
|
271
|
+
2, (completion_type, polling_type));
|
118
272
|
|
119
|
-
|
273
|
+
const cq_poller_vtable *poller_vtable =
|
274
|
+
&g_poller_vtable_by_poller_type[polling_type];
|
120
275
|
|
121
|
-
cc = gpr_zalloc(sizeof(grpc_completion_queue) +
|
122
|
-
|
276
|
+
cc = gpr_zalloc(sizeof(grpc_completion_queue) + poller_vtable->size());
|
277
|
+
poller_vtable->init(POLLSET_FROM_CQ(cc), &cc->mu);
|
123
278
|
#ifndef NDEBUG
|
124
279
|
cc->outstanding_tags = NULL;
|
125
280
|
cc->outstanding_tag_capacity = 0;
|
126
281
|
#endif
|
127
282
|
|
283
|
+
cc->completion_type = completion_type;
|
284
|
+
cc->poller_vtable = poller_vtable;
|
285
|
+
|
128
286
|
/* Initial ref is dropped by grpc_completion_queue_shutdown */
|
129
287
|
gpr_ref_init(&cc->pending_events, 1);
|
130
288
|
/* One for destroy(), one for pollset_shutdown */
|
@@ -143,11 +301,15 @@ grpc_completion_queue *grpc_completion_queue_create(void *reserved) {
|
|
143
301
|
grpc_closure_init(&cc->pollset_shutdown_done, on_pollset_shutdown_done, cc,
|
144
302
|
grpc_schedule_on_exec_ctx);
|
145
303
|
|
146
|
-
GPR_TIMER_END("
|
304
|
+
GPR_TIMER_END("grpc_completion_queue_create_internal", 0);
|
147
305
|
|
148
306
|
return cc;
|
149
307
|
}
|
150
308
|
|
309
|
+
grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc) {
|
310
|
+
return cc->completion_type;
|
311
|
+
}
|
312
|
+
|
151
313
|
#ifdef GRPC_CQ_REF_COUNT_DEBUG
|
152
314
|
void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason,
|
153
315
|
const char *file, int line) {
|
@@ -162,20 +324,21 @@ void grpc_cq_internal_ref(grpc_completion_queue *cc) {
|
|
162
324
|
static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *arg,
|
163
325
|
grpc_error *error) {
|
164
326
|
grpc_completion_queue *cc = arg;
|
165
|
-
GRPC_CQ_INTERNAL_UNREF(cc, "pollset_destroy");
|
327
|
+
GRPC_CQ_INTERNAL_UNREF(exec_ctx, cc, "pollset_destroy");
|
166
328
|
}
|
167
329
|
|
168
330
|
#ifdef GRPC_CQ_REF_COUNT_DEBUG
|
169
|
-
void grpc_cq_internal_unref(
|
170
|
-
const char *file, int line) {
|
331
|
+
void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc,
|
332
|
+
const char *reason, const char *file, int line) {
|
171
333
|
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "CQ:%p unref %d -> %d %s", cc,
|
172
334
|
(int)cc->owning_refs.count, (int)cc->owning_refs.count - 1, reason);
|
173
335
|
#else
|
174
|
-
void grpc_cq_internal_unref(
|
336
|
+
void grpc_cq_internal_unref(grpc_exec_ctx *exec_ctx,
|
337
|
+
grpc_completion_queue *cc) {
|
175
338
|
#endif
|
176
339
|
if (gpr_unref(&cc->owning_refs)) {
|
177
340
|
GPR_ASSERT(cc->completed_head.next == (uintptr_t)&cc->completed_head);
|
178
|
-
|
341
|
+
cc->poller_vtable->destroy(exec_ctx, POLLSET_FROM_CQ(cc));
|
179
342
|
#ifndef NDEBUG
|
180
343
|
gpr_free(cc->outstanding_tags);
|
181
344
|
#endif
|
@@ -215,14 +378,16 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc,
|
|
215
378
|
#endif
|
216
379
|
|
217
380
|
GPR_TIMER_BEGIN("grpc_cq_end_op", 0);
|
218
|
-
if (grpc_api_trace ||
|
219
|
-
(grpc_trace_operation_failures &&
|
381
|
+
if (GRPC_TRACER_ON(grpc_api_trace) ||
|
382
|
+
(GRPC_TRACER_ON(grpc_trace_operation_failures) &&
|
383
|
+
error != GRPC_ERROR_NONE)) {
|
220
384
|
const char *errmsg = grpc_error_string(error);
|
221
385
|
GRPC_API_TRACE(
|
222
386
|
"grpc_cq_end_op(exec_ctx=%p, cc=%p, tag=%p, error=%s, done=%p, "
|
223
387
|
"done_arg=%p, storage=%p)",
|
224
388
|
7, (exec_ctx, cc, tag, errmsg, done, done_arg, storage));
|
225
|
-
if (grpc_trace_operation_failures &&
|
389
|
+
if (GRPC_TRACER_ON(grpc_trace_operation_failures) &&
|
390
|
+
error != GRPC_ERROR_NONE) {
|
226
391
|
gpr_log(GPR_ERROR, "Operation failed: tag=%p, error=%s", tag, errmsg);
|
227
392
|
}
|
228
393
|
}
|
@@ -260,7 +425,7 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc,
|
|
260
425
|
}
|
261
426
|
}
|
262
427
|
grpc_error *kick_error =
|
263
|
-
|
428
|
+
cc->poller_vtable->kick(POLLSET_FROM_CQ(cc), pluck_worker);
|
264
429
|
gpr_mu_unlock(cc->mu);
|
265
430
|
if (kick_error != GRPC_ERROR_NONE) {
|
266
431
|
const char *msg = grpc_error_string(kick_error);
|
@@ -275,8 +440,8 @@ void grpc_cq_end_op(grpc_exec_ctx *exec_ctx, grpc_completion_queue *cc,
|
|
275
440
|
GPR_ASSERT(!cc->shutdown);
|
276
441
|
GPR_ASSERT(cc->shutdown_called);
|
277
442
|
cc->shutdown = 1;
|
278
|
-
|
279
|
-
|
443
|
+
cc->poller_vtable->shutdown(exec_ctx, POLLSET_FROM_CQ(cc),
|
444
|
+
&cc->pollset_shutdown_done);
|
280
445
|
gpr_mu_unlock(cc->mu);
|
281
446
|
}
|
282
447
|
|
@@ -321,7 +486,7 @@ static bool cq_is_next_finished(grpc_exec_ctx *exec_ctx, void *arg) {
|
|
321
486
|
|
322
487
|
#ifndef NDEBUG
|
323
488
|
static void dump_pending_tags(grpc_completion_queue *cc) {
|
324
|
-
if (!grpc_trace_pending_tags) return;
|
489
|
+
if (!GRPC_TRACER_ON(grpc_trace_pending_tags)) return;
|
325
490
|
|
326
491
|
gpr_strvec v;
|
327
492
|
gpr_strvec_init(&v);
|
@@ -347,6 +512,13 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
|
|
347
512
|
grpc_event ret;
|
348
513
|
gpr_timespec now;
|
349
514
|
|
515
|
+
if (cc->completion_type != GRPC_CQ_NEXT) {
|
516
|
+
gpr_log(GPR_ERROR,
|
517
|
+
"grpc_completion_queue_next() cannot be called on this completion "
|
518
|
+
"queue since its completion type is not GRPC_CQ_NEXT");
|
519
|
+
abort();
|
520
|
+
}
|
521
|
+
|
350
522
|
GPR_TIMER_BEGIN("grpc_completion_queue_next", 0);
|
351
523
|
|
352
524
|
GRPC_API_TRACE(
|
@@ -413,36 +585,23 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc,
|
|
413
585
|
dump_pending_tags(cc);
|
414
586
|
break;
|
415
587
|
}
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
TODO(ctiller): can this work be localized? */
|
420
|
-
gpr_timespec iteration_deadline = deadline;
|
421
|
-
if (grpc_timer_check(&exec_ctx, now, &iteration_deadline)) {
|
422
|
-
GPR_TIMER_MARK("alarm_triggered", 0);
|
588
|
+
grpc_error *err = cc->poller_vtable->work(&exec_ctx, POLLSET_FROM_CQ(cc),
|
589
|
+
NULL, now, deadline);
|
590
|
+
if (err != GRPC_ERROR_NONE) {
|
423
591
|
gpr_mu_unlock(cc->mu);
|
424
|
-
|
425
|
-
|
426
|
-
continue;
|
427
|
-
} else {
|
428
|
-
grpc_error *err = grpc_pollset_work(&exec_ctx, POLLSET_FROM_CQ(cc), NULL,
|
429
|
-
now, iteration_deadline);
|
430
|
-
if (err != GRPC_ERROR_NONE) {
|
431
|
-
gpr_mu_unlock(cc->mu);
|
432
|
-
const char *msg = grpc_error_string(err);
|
433
|
-
gpr_log(GPR_ERROR, "Completion queue next failed: %s", msg);
|
592
|
+
const char *msg = grpc_error_string(err);
|
593
|
+
gpr_log(GPR_ERROR, "Completion queue next failed: %s", msg);
|
434
594
|
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
}
|
595
|
+
GRPC_ERROR_UNREF(err);
|
596
|
+
memset(&ret, 0, sizeof(ret));
|
597
|
+
ret.type = GRPC_QUEUE_TIMEOUT;
|
598
|
+
dump_pending_tags(cc);
|
599
|
+
break;
|
441
600
|
}
|
442
601
|
is_finished_arg.first_loop = false;
|
443
602
|
}
|
444
603
|
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ret);
|
445
|
-
GRPC_CQ_INTERNAL_UNREF(cc, "next");
|
604
|
+
GRPC_CQ_INTERNAL_UNREF(&exec_ctx, cc, "next");
|
446
605
|
grpc_exec_ctx_finish(&exec_ctx);
|
447
606
|
GPR_ASSERT(is_finished_arg.stolen_completion == NULL);
|
448
607
|
|
@@ -516,7 +675,14 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
|
|
516
675
|
|
517
676
|
GPR_TIMER_BEGIN("grpc_completion_queue_pluck", 0);
|
518
677
|
|
519
|
-
if (
|
678
|
+
if (cc->completion_type != GRPC_CQ_PLUCK) {
|
679
|
+
gpr_log(GPR_ERROR,
|
680
|
+
"grpc_completion_queue_pluck() cannot be called on this completion "
|
681
|
+
"queue since its completion type is not GRPC_CQ_PLUCK");
|
682
|
+
abort();
|
683
|
+
}
|
684
|
+
|
685
|
+
if (GRPC_TRACER_ON(grpc_cq_pluck_trace)) {
|
520
686
|
GRPC_API_TRACE(
|
521
687
|
"grpc_completion_queue_pluck("
|
522
688
|
"cc=%p, tag=%p, "
|
@@ -599,38 +765,26 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
|
|
599
765
|
dump_pending_tags(cc);
|
600
766
|
break;
|
601
767
|
}
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
gpr_timespec iteration_deadline = deadline;
|
607
|
-
if (grpc_timer_check(&exec_ctx, now, &iteration_deadline)) {
|
608
|
-
GPR_TIMER_MARK("alarm_triggered", 0);
|
768
|
+
grpc_error *err = cc->poller_vtable->work(&exec_ctx, POLLSET_FROM_CQ(cc),
|
769
|
+
&worker, now, deadline);
|
770
|
+
if (err != GRPC_ERROR_NONE) {
|
771
|
+
del_plucker(cc, tag, &worker);
|
609
772
|
gpr_mu_unlock(cc->mu);
|
610
|
-
|
611
|
-
|
612
|
-
} else {
|
613
|
-
grpc_error *err = grpc_pollset_work(&exec_ctx, POLLSET_FROM_CQ(cc),
|
614
|
-
&worker, now, iteration_deadline);
|
615
|
-
if (err != GRPC_ERROR_NONE) {
|
616
|
-
del_plucker(cc, tag, &worker);
|
617
|
-
gpr_mu_unlock(cc->mu);
|
618
|
-
const char *msg = grpc_error_string(err);
|
619
|
-
gpr_log(GPR_ERROR, "Completion queue next failed: %s", msg);
|
773
|
+
const char *msg = grpc_error_string(err);
|
774
|
+
gpr_log(GPR_ERROR, "Completion queue next failed: %s", msg);
|
620
775
|
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
}
|
776
|
+
GRPC_ERROR_UNREF(err);
|
777
|
+
memset(&ret, 0, sizeof(ret));
|
778
|
+
ret.type = GRPC_QUEUE_TIMEOUT;
|
779
|
+
dump_pending_tags(cc);
|
780
|
+
break;
|
627
781
|
}
|
628
782
|
is_finished_arg.first_loop = false;
|
629
783
|
del_plucker(cc, tag, &worker);
|
630
784
|
}
|
631
785
|
done:
|
632
786
|
GRPC_SURFACE_TRACE_RETURNED_EVENT(cc, &ret);
|
633
|
-
GRPC_CQ_INTERNAL_UNREF(cc, "pluck");
|
787
|
+
GRPC_CQ_INTERNAL_UNREF(&exec_ctx, cc, "pluck");
|
634
788
|
grpc_exec_ctx_finish(&exec_ctx);
|
635
789
|
GPR_ASSERT(is_finished_arg.stolen_completion == NULL);
|
636
790
|
|
@@ -655,8 +809,8 @@ void grpc_completion_queue_shutdown(grpc_completion_queue *cc) {
|
|
655
809
|
if (gpr_unref(&cc->pending_events)) {
|
656
810
|
GPR_ASSERT(!cc->shutdown);
|
657
811
|
cc->shutdown = 1;
|
658
|
-
|
659
|
-
|
812
|
+
cc->poller_vtable->shutdown(&exec_ctx, POLLSET_FROM_CQ(cc),
|
813
|
+
&cc->pollset_shutdown_done);
|
660
814
|
}
|
661
815
|
gpr_mu_unlock(cc->mu);
|
662
816
|
grpc_exec_ctx_finish(&exec_ctx);
|
@@ -667,12 +821,14 @@ void grpc_completion_queue_destroy(grpc_completion_queue *cc) {
|
|
667
821
|
GRPC_API_TRACE("grpc_completion_queue_destroy(cc=%p)", 1, (cc));
|
668
822
|
GPR_TIMER_BEGIN("grpc_completion_queue_destroy", 0);
|
669
823
|
grpc_completion_queue_shutdown(cc);
|
670
|
-
|
824
|
+
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
|
825
|
+
GRPC_CQ_INTERNAL_UNREF(&exec_ctx, cc, "destroy");
|
826
|
+
grpc_exec_ctx_finish(&exec_ctx);
|
671
827
|
GPR_TIMER_END("grpc_completion_queue_destroy", 0);
|
672
828
|
}
|
673
829
|
|
674
830
|
grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) {
|
675
|
-
return POLLSET_FROM_CQ(cc);
|
831
|
+
return cc->poller_vtable->can_get_pollset ? POLLSET_FROM_CQ(cc) : NULL;
|
676
832
|
}
|
677
833
|
|
678
834
|
grpc_completion_queue *grpc_cq_from_pollset(grpc_pollset *ps) {
|
@@ -680,13 +836,23 @@ grpc_completion_queue *grpc_cq_from_pollset(grpc_pollset *ps) {
|
|
680
836
|
}
|
681
837
|
|
682
838
|
void grpc_cq_mark_non_listening_server_cq(grpc_completion_queue *cc) {
|
839
|
+
/* TODO: sreek - use cc->polling_type field here and add a validation check
|
840
|
+
(i.e grpc_cq_mark_non_listening_server_cq can only be called on a cc whose
|
841
|
+
polling_type is set to GRPC_CQ_NON_LISTENING */
|
683
842
|
cc->is_non_listening_server_cq = 1;
|
684
843
|
}
|
685
844
|
|
686
845
|
bool grpc_cq_is_non_listening_server_cq(grpc_completion_queue *cc) {
|
846
|
+
/* TODO (sreek) - return (cc->polling_type == GRPC_CQ_NON_LISTENING) */
|
687
847
|
return (cc->is_non_listening_server_cq == 1);
|
688
848
|
}
|
689
849
|
|
690
850
|
void grpc_cq_mark_server_cq(grpc_completion_queue *cc) { cc->is_server_cq = 1; }
|
691
851
|
|
692
|
-
|
852
|
+
bool grpc_cq_is_server_cq(grpc_completion_queue *cc) {
|
853
|
+
return cc->is_server_cq;
|
854
|
+
}
|
855
|
+
|
856
|
+
bool grpc_cq_can_listen(grpc_completion_queue *cc) {
|
857
|
+
return cc->poller_vtable->can_listen;
|
858
|
+
}
|