Merge pull request #3556 from ctiller/clangf

Fix clang-format script
pull/3601/head
Vijay Pai 9 years ago
commit 7a94236d69
  1. 13
      src/core/channel/client_channel.c
  2. 13
      src/core/channel/compress_filter.c
  3. 13
      src/core/channel/connected_channel.c
  4. 14
      src/core/channel/noop_filter.c
  5. 9
      src/core/client_config/lb_policies/pick_first.c
  6. 9
      src/core/client_config/lb_policies/round_robin.c
  7. 20
      src/core/client_config/subchannel.c
  8. 11
      src/core/iomgr/iocp_windows.c
  9. 7
      src/core/iomgr/iomgr_posix.c
  10. 4
      src/core/iomgr/iomgr_windows.c
  11. 8
      src/core/iomgr/pollset_multipoller_with_epoll.c
  12. 4
      src/core/iomgr/pollset_posix.c
  13. 60
      src/core/iomgr/pollset_windows.c
  14. 4
      src/core/iomgr/tcp_posix.c
  15. 6
      src/core/iomgr/tcp_windows.c
  16. 2
      src/core/iomgr/udp_server.c
  17. 9
      src/core/security/client_auth_filter.c
  18. 5
      src/core/security/secure_endpoint.c
  19. 9
      src/core/security/server_auth_filter.c
  20. 4
      src/core/statistics/census_rpc_stats.c
  21. 7
      src/core/statistics/census_tracing.c
  22. 3
      src/core/support/slice_buffer.c
  23. 13
      src/core/surface/lame_client.c
  24. 18
      src/core/surface/server.c
  25. 4
      src/core/surface/version.c
  26. 76
      src/core/transport/chttp2/bin_encoder.c
  27. 10
      src/core/transport/chttp2/hpack_parser.c
  28. 320
      src/core/transport/chttp2/huffsyms.c
  29. 4
      src/core/transport/chttp2/stream_encoder.c
  30. 14
      src/core/transport/chttp2_transport.c
  31. 6
      src/core/tsi/fake_transport_security.c
  32. 6
      src/core/tsi/ssl_transport_security.c
  33. 3
      src/cpp/proto/proto_utils.cc
  34. 8
      src/cpp/server/secure_server_credentials.cc
  35. 2
      src/cpp/server/server.cc
  36. 2
      src/cpp/server/server_builder.cc
  37. 24
      src/cpp/util/string_ref.cc
  38. 6
      test/core/bad_client/bad_client.c
  39. 6
      test/core/bad_client/tests/connection_prefix.c
  40. 6
      test/core/bad_client/tests/initial_settings_frame.c
  41. 9
      test/core/channel/channel_stack_test.c
  42. 16
      test/core/client_config/lb_policies_test.c
  43. 6
      test/core/end2end/dualstack_socket_test.c
  44. 5
      test/core/end2end/no_server_test.c
  45. 6
      test/core/end2end/tests/bad_hostname.c
  46. 6
      test/core/end2end/tests/binary_metadata.c
  47. 6
      test/core/end2end/tests/call_creds.c
  48. 6
      test/core/end2end/tests/cancel_after_accept.c
  49. 6
      test/core/end2end/tests/cancel_after_client_done.c
  50. 6
      test/core/end2end/tests/cancel_after_invoke.c
  51. 6
      test/core/end2end/tests/cancel_before_invoke.c
  52. 6
      test/core/end2end/tests/cancel_in_a_vacuum.c
  53. 6
      test/core/end2end/tests/census_simple_request.c
  54. 10
      test/core/end2end/tests/channel_connectivity.c
  55. 6
      test/core/end2end/tests/compressed_payload.c
  56. 6
      test/core/end2end/tests/default_host.c
  57. 6
      test/core/end2end/tests/empty_batch.c
  58. 6
      test/core/end2end/tests/high_initial_seqno.c
  59. 6
      test/core/end2end/tests/invoke_large_request.c
  60. 6
      test/core/end2end/tests/large_metadata.c
  61. 6
      test/core/end2end/tests/max_concurrent_streams.c
  62. 6
      test/core/end2end/tests/max_message_length.c
  63. 6
      test/core/end2end/tests/metadata.c
  64. 6
      test/core/end2end/tests/no_op.c
  65. 6
      test/core/end2end/tests/payload.c
  66. 6
      test/core/end2end/tests/ping_pong_streaming.c
  67. 6
      test/core/end2end/tests/registered_call.c
  68. 6
      test/core/end2end/tests/request_with_flags.c
  69. 6
      test/core/end2end/tests/request_with_payload.c
  70. 6
      test/core/end2end/tests/server_finishes_request.c
  71. 6
      test/core/end2end/tests/simple_delayed_request.c
  72. 6
      test/core/end2end/tests/simple_request.c
  73. 6
      test/core/end2end/tests/trailing_metadata.c
  74. 3
      test/core/httpcli/format_request_test.c
  75. 2
      test/core/json/json_test.c
  76. 22
      test/core/statistics/hash_table_test.c
  77. 4
      test/cpp/end2end/end2end_test.cc
  78. 94
      test/cpp/end2end/streaming_throughput_test.cc
  79. 4
      test/cpp/interop/client.cc
  80. 3
      test/cpp/interop/interop_client.cc
  81. 1
      test/cpp/interop/interop_test.cc
  82. 8
      test/cpp/qps/driver.cc
  83. 4
      test/cpp/qps/server_async.cc
  84. 4
      test/cpp/qps/server_sync.cc
  85. 18
      test/cpp/util/string_ref_test.cc
  86. 2
      tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh

@ -692,16 +692,9 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
} }
const grpc_channel_filter grpc_client_channel_filter = { const grpc_channel_filter grpc_client_channel_filter = {
cc_start_transport_stream_op, cc_start_transport_stream_op, cc_start_transport_op, sizeof(call_data),
cc_start_transport_op, init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
sizeof(call_data), destroy_channel_elem, cc_get_peer, "client-channel",
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
cc_get_peer,
"client-channel",
}; };
void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx, void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx,

@ -387,13 +387,6 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
} }
const grpc_channel_filter grpc_compress_filter = { const grpc_channel_filter grpc_compress_filter = {
compress_start_transport_stream_op, compress_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
grpc_channel_next_op, init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
sizeof(call_data), destroy_channel_elem, grpc_call_next_get_peer, "compress"};
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
grpc_call_next_get_peer,
"compress"};

@ -130,16 +130,9 @@ static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
} }
const grpc_channel_filter grpc_connected_channel_filter = { const grpc_channel_filter grpc_connected_channel_filter = {
con_start_transport_stream_op, con_start_transport_stream_op, con_start_transport_op, sizeof(call_data),
con_start_transport_op, init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
sizeof(call_data), destroy_channel_elem, con_get_peer, "connected",
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
con_get_peer,
"connected",
}; };
void grpc_connected_channel_bind_transport(grpc_channel_stack *channel_stack, void grpc_connected_channel_bind_transport(grpc_channel_stack *channel_stack,

@ -116,13 +116,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
ignore_unused(channeld); ignore_unused(channeld);
} }
const grpc_channel_filter grpc_no_op_filter = {noop_start_transport_stream_op, const grpc_channel_filter grpc_no_op_filter = {
grpc_channel_next_op, noop_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
init_call_elem, destroy_channel_elem, grpc_call_next_get_peer, "no-op"};
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
grpc_call_next_get_peer,
"no-op"};

@ -317,13 +317,8 @@ void pf_notify_on_state_change(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
} }
static const grpc_lb_policy_vtable pick_first_lb_policy_vtable = { static const grpc_lb_policy_vtable pick_first_lb_policy_vtable = {
pf_destroy, pf_destroy, pf_shutdown, pf_pick, pf_exit_idle, pf_broadcast,
pf_shutdown, pf_check_connectivity, pf_notify_on_state_change};
pf_pick,
pf_exit_idle,
pf_broadcast,
pf_check_connectivity,
pf_notify_on_state_change};
static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {} static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {}

@ -487,13 +487,8 @@ static void rr_notify_on_state_change(grpc_exec_ctx *exec_ctx,
} }
static const grpc_lb_policy_vtable round_robin_lb_policy_vtable = { static const grpc_lb_policy_vtable round_robin_lb_policy_vtable = {
rr_destroy, rr_destroy, rr_shutdown, rr_pick, rr_exit_idle, rr_broadcast,
rr_shutdown, rr_check_connectivity, rr_notify_on_state_change};
rr_pick,
rr_exit_idle,
rr_broadcast,
rr_check_connectivity,
rr_notify_on_state_change};
static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {} static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {}

@ -153,8 +153,8 @@ static gpr_timespec compute_connect_deadline(grpc_subchannel *c);
static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel, static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
int iomgr_success); int iomgr_success);
static void subchannel_ref_locked( static void subchannel_ref_locked(grpc_subchannel *c
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS); GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
static int subchannel_unref_locked( static int subchannel_unref_locked(
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) GRPC_MUST_USE_RESULT; grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) GRPC_MUST_USE_RESULT;
static void connection_ref_locked(connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS); static void connection_ref_locked(connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
@ -203,8 +203,8 @@ static void connection_destroy(grpc_exec_ctx *exec_ctx, connection *c) {
gpr_free(c); gpr_free(c);
} }
static void connection_ref_locked( static void connection_ref_locked(connection *c
connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
REF_LOG("CONNECTION", c); REF_LOG("CONNECTION", c);
subchannel_ref_locked(c->subchannel REF_PASS_ARGS); subchannel_ref_locked(c->subchannel REF_PASS_ARGS);
++c->refs; ++c->refs;
@ -227,14 +227,14 @@ static grpc_subchannel *connection_unref_locked(
* grpc_subchannel implementation * grpc_subchannel implementation
*/ */
static void subchannel_ref_locked( static void subchannel_ref_locked(grpc_subchannel *c
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
REF_LOG("SUBCHANNEL", c); REF_LOG("SUBCHANNEL", c);
++c->refs; ++c->refs;
} }
static int subchannel_unref_locked( static int subchannel_unref_locked(grpc_subchannel *c
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
UNREF_LOG("SUBCHANNEL", c); UNREF_LOG("SUBCHANNEL", c);
return --c->refs == 0; return --c->refs == 0;
} }
@ -709,8 +709,8 @@ static void connectivity_state_changed_locked(grpc_exec_ctx *exec_ctx,
* grpc_subchannel_call implementation * grpc_subchannel_call implementation
*/ */
void grpc_subchannel_call_ref( void grpc_subchannel_call_ref(grpc_subchannel_call *c
grpc_subchannel_call *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_ref(&c->refs); gpr_ref(&c->refs);
} }

@ -62,13 +62,13 @@ static DWORD deadline_to_millis_timeout(gpr_timespec deadline,
return INFINITE; return INFINITE;
} }
if (gpr_time_cmp(deadline, gpr_time_add(now, gpr_time_from_micros( if (gpr_time_cmp(deadline, gpr_time_add(now, gpr_time_from_micros(
max_spin_polling_us, max_spin_polling_us,
GPR_TIMESPAN))) <= 0) { GPR_TIMESPAN))) <= 0) {
return 0; return 0;
} }
timeout = gpr_time_sub(deadline, now); timeout = gpr_time_sub(deadline, now);
return gpr_time_to_millis(gpr_time_add( return gpr_time_to_millis(gpr_time_add(
timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN))); timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN)));
} }
void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) { void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
@ -80,8 +80,9 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
grpc_winsocket *socket; grpc_winsocket *socket;
grpc_winsocket_callback_info *info; grpc_winsocket_callback_info *info;
grpc_closure *closure = NULL; grpc_closure *closure = NULL;
success = GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key, success = GetQueuedCompletionStatus(
&overlapped, deadline_to_millis_timeout(deadline, gpr_now(deadline.clock_type))); g_iocp, &bytes, &completion_key, &overlapped,
deadline_to_millis_timeout(deadline, gpr_now(deadline.clock_type)));
if (success == 0 && overlapped == NULL) { if (success == 0 && overlapped == NULL) {
return; return;
} }

@ -45,11 +45,8 @@ void grpc_iomgr_platform_init(void) {
grpc_register_tracer("tcp", &grpc_tcp_trace); grpc_register_tracer("tcp", &grpc_tcp_trace);
} }
void grpc_iomgr_platform_flush(void) { void grpc_iomgr_platform_flush(void) {}
}
void grpc_iomgr_platform_shutdown(void) { void grpc_iomgr_platform_shutdown(void) { grpc_fd_global_shutdown(); }
grpc_fd_global_shutdown();
}
#endif /* GRPC_POSIX_SOCKET */ #endif /* GRPC_POSIX_SOCKET */

@ -63,9 +63,7 @@ void grpc_iomgr_platform_init(void) {
grpc_iocp_init(); grpc_iocp_init();
} }
void grpc_iomgr_platform_flush(void) { void grpc_iomgr_platform_flush(void) { grpc_iocp_flush(); }
grpc_iocp_flush();
}
void grpc_iomgr_platform_shutdown(void) { void grpc_iomgr_platform_shutdown(void) {
grpc_iocp_shutdown(); grpc_iocp_shutdown();

@ -198,7 +198,7 @@ static void multipoll_with_epoll_pollset_maybe_work_and_unlock(
} }
if (pfds[1].revents) { if (pfds[1].revents) {
do { do {
/* The following epoll_wait never blocks; it has a timeout of 0 */ /* The following epoll_wait never blocks; it has a timeout of 0 */
ep_rv = epoll_wait(h->epoll_fd, ep_ev, GRPC_EPOLL_MAX_EVENTS, 0); ep_rv = epoll_wait(h->epoll_fd, ep_ev, GRPC_EPOLL_MAX_EVENTS, 0);
if (ep_rv < 0) { if (ep_rv < 0) {
if (errno != EINTR) { if (errno != EINTR) {
@ -264,9 +264,11 @@ static void epoll_become_multipoller(grpc_exec_ctx *exec_ctx,
ev.events = (uint32_t)(EPOLLIN | EPOLLET); ev.events = (uint32_t)(EPOLLIN | EPOLLET);
ev.data.ptr = NULL; ev.data.ptr = NULL;
err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD, GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), &ev); err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD,
GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), &ev);
if (err < 0) { if (err < 0) {
gpr_log(GPR_ERROR, "epoll_ctl add for %d failed: %s", GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), gpr_log(GPR_ERROR, "epoll_ctl add for %d failed: %s",
GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd),
strerror(errno)); strerror(errno));
} }

@ -139,9 +139,7 @@ void grpc_pollset_global_shutdown(void) {
gpr_tls_destroy(&g_current_thread_worker); gpr_tls_destroy(&g_current_thread_worker);
} }
void grpc_kick_poller(void) { void grpc_kick_poller(void) { grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd); }
grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd);
}
/* main interface */ /* main interface */

@ -51,13 +51,11 @@ void grpc_pollset_global_init() {
gpr_mu_init(&grpc_polling_mu); gpr_mu_init(&grpc_polling_mu);
g_active_poller = NULL; g_active_poller = NULL;
g_global_root_worker.links[GRPC_POLLSET_WORKER_LINK_GLOBAL].next = g_global_root_worker.links[GRPC_POLLSET_WORKER_LINK_GLOBAL].next =
g_global_root_worker.links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev = g_global_root_worker.links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev =
&g_global_root_worker; &g_global_root_worker;
} }
void grpc_pollset_global_shutdown() { void grpc_pollset_global_shutdown() { gpr_mu_destroy(&grpc_polling_mu); }
gpr_mu_destroy(&grpc_polling_mu);
}
static void remove_worker(grpc_pollset_worker *worker, static void remove_worker(grpc_pollset_worker *worker,
grpc_pollset_worker_link_type type) { grpc_pollset_worker_link_type type) {
@ -66,7 +64,8 @@ static void remove_worker(grpc_pollset_worker *worker,
worker->links[type].next = worker->links[type].prev = worker; worker->links[type].next = worker->links[type].prev = worker;
} }
static int has_workers(grpc_pollset_worker *root, grpc_pollset_worker_link_type type) { static int has_workers(grpc_pollset_worker *root,
grpc_pollset_worker_link_type type) {
return root->links[type].next != root; return root->links[type].next != root;
} }
@ -87,8 +86,7 @@ static void push_back_worker(grpc_pollset_worker *root,
worker->links[type].next = root; worker->links[type].next = root;
worker->links[type].prev = worker->links[type].next->links[type].prev; worker->links[type].prev = worker->links[type].next->links[type].prev;
worker->links[type].prev->links[type].next = worker->links[type].prev->links[type].next =
worker->links[type].next->links[type].prev = worker->links[type].next->links[type].prev = worker;
worker;
} }
static void push_front_worker(grpc_pollset_worker *root, static void push_front_worker(grpc_pollset_worker *root,
@ -97,8 +95,7 @@ static void push_front_worker(grpc_pollset_worker *root,
worker->links[type].prev = root; worker->links[type].prev = root;
worker->links[type].next = worker->links[type].prev->links[type].next; worker->links[type].next = worker->links[type].prev->links[type].next;
worker->links[type].prev->links[type].next = worker->links[type].prev->links[type].next =
worker->links[type].next->links[type].prev = worker->links[type].next->links[type].prev = worker;
worker;
} }
/* There isn't really any such thing as a pollset under Windows, due to the /* There isn't really any such thing as a pollset under Windows, due to the
@ -109,8 +106,8 @@ static void push_front_worker(grpc_pollset_worker *root,
void grpc_pollset_init(grpc_pollset *pollset) { void grpc_pollset_init(grpc_pollset *pollset) {
memset(pollset, 0, sizeof(*pollset)); memset(pollset, 0, sizeof(*pollset));
pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next = pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next =
pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev = pollset->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev =
&pollset->root_worker; &pollset->root_worker;
} }
void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
@ -126,18 +123,16 @@ void grpc_pollset_shutdown(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
gpr_mu_unlock(&grpc_polling_mu); gpr_mu_unlock(&grpc_polling_mu);
} }
void grpc_pollset_destroy(grpc_pollset *pollset) { void grpc_pollset_destroy(grpc_pollset *pollset) {}
}
void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
grpc_pollset_worker *worker, gpr_timespec now, grpc_pollset_worker *worker, gpr_timespec now,
gpr_timespec deadline) { gpr_timespec deadline) {
int added_worker = 0; int added_worker = 0;
worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next = worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next =
worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev = worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].prev =
worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].next = worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].next =
worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev = worker->links[GRPC_POLLSET_WORKER_LINK_GLOBAL].prev = NULL;
NULL;
worker->kicked = 0; worker->kicked = 0;
worker->pollset = pollset; worker->pollset = pollset;
gpr_cv_init(&worker->cv); gpr_cv_init(&worker->cv);
@ -157,9 +152,13 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
pollset->is_iocp_worker = 0; pollset->is_iocp_worker = 0;
g_active_poller = NULL; g_active_poller = NULL;
/* try to get a worker from this pollsets worker list */ /* try to get a worker from this pollsets worker list */
next_worker = pop_front_worker(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET); next_worker = pop_front_worker(&pollset->root_worker,
/* try to get a worker from the global list */ GRPC_POLLSET_WORKER_LINK_POLLSET);
next_worker = pop_front_worker(&g_global_root_worker, GRPC_POLLSET_WORKER_LINK_GLOBAL); if (next_worker == NULL) {
/* try to get a worker from the global list */
next_worker = pop_front_worker(&g_global_root_worker,
GRPC_POLLSET_WORKER_LINK_GLOBAL);
}
if (next_worker != NULL) { if (next_worker != NULL) {
next_worker->kicked = 1; next_worker->kicked = 1;
gpr_cv_signal(&next_worker->cv); gpr_cv_signal(&next_worker->cv);
@ -171,8 +170,10 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
} }
goto done; goto done;
} }
push_front_worker(&g_global_root_worker, GRPC_POLLSET_WORKER_LINK_GLOBAL, worker); push_front_worker(&g_global_root_worker, GRPC_POLLSET_WORKER_LINK_GLOBAL,
push_front_worker(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET, worker); worker);
push_front_worker(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET,
worker);
added_worker = 1; added_worker = 1;
while (!worker->kicked) { while (!worker->kicked) {
if (gpr_cv_wait(&worker->cv, &grpc_polling_mu, deadline)) { if (gpr_cv_wait(&worker->cv, &grpc_polling_mu, deadline)) {
@ -198,9 +199,11 @@ done:
void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) { void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) {
if (specific_worker != NULL) { if (specific_worker != NULL) {
if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) { if (specific_worker == GRPC_POLLSET_KICK_BROADCAST) {
for (specific_worker = p->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next; for (specific_worker =
p->root_worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next;
specific_worker != &p->root_worker; specific_worker != &p->root_worker;
specific_worker = specific_worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next) { specific_worker =
specific_worker->links[GRPC_POLLSET_WORKER_LINK_POLLSET].next) {
specific_worker->kicked = 1; specific_worker->kicked = 1;
gpr_cv_signal(&specific_worker->cv); gpr_cv_signal(&specific_worker->cv);
} }
@ -219,7 +222,8 @@ void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) {
} }
} }
} else { } else {
specific_worker = pop_front_worker(&p->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET); specific_worker =
pop_front_worker(&p->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET);
if (specific_worker != NULL) { if (specific_worker != NULL) {
grpc_pollset_kick(p, specific_worker); grpc_pollset_kick(p, specific_worker);
} else if (p->is_iocp_worker) { } else if (p->is_iocp_worker) {
@ -230,8 +234,6 @@ void grpc_pollset_kick(grpc_pollset *p, grpc_pollset_worker *specific_worker) {
} }
} }
void grpc_kick_poller(void) { void grpc_kick_poller(void) { grpc_iocp_kick(); }
grpc_iocp_kick();
}
#endif /* GPR_WINSOCK_SOCKET */ #endif /* GPR_WINSOCK_SOCKET */

@ -292,7 +292,7 @@ static flush_result tcp_flush(grpc_tcp *tcp) {
unwind_slice_idx = tcp->outgoing_slice_idx; unwind_slice_idx = tcp->outgoing_slice_idx;
unwind_byte_idx = tcp->outgoing_byte_idx; unwind_byte_idx = tcp->outgoing_byte_idx;
for (iov_size = 0; tcp->outgoing_slice_idx != tcp->outgoing_buffer->count && for (iov_size = 0; tcp->outgoing_slice_idx != tcp->outgoing_buffer->count &&
iov_size != MAX_WRITE_IOVEC; iov_size != MAX_WRITE_IOVEC;
iov_size++) { iov_size++) {
iov[iov_size].iov_base = iov[iov_size].iov_base =
GPR_SLICE_START_PTR( GPR_SLICE_START_PTR(
@ -441,7 +441,7 @@ static char *tcp_get_peer(grpc_endpoint *ep) {
} }
static const grpc_endpoint_vtable vtable = { static const grpc_endpoint_vtable vtable = {
tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set, tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set,
tcp_shutdown, tcp_destroy, tcp_get_peer}; tcp_shutdown, tcp_destroy, tcp_get_peer};
grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size, grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size,

@ -382,9 +382,9 @@ static char *win_get_peer(grpc_endpoint *ep) {
return gpr_strdup(tcp->peer_string); return gpr_strdup(tcp->peer_string);
} }
static grpc_endpoint_vtable vtable = { static grpc_endpoint_vtable vtable = {win_read, win_write, win_add_to_pollset,
win_read, win_write, win_add_to_pollset, win_add_to_pollset_set, win_add_to_pollset_set, win_shutdown,
win_shutdown, win_destroy, win_get_peer}; win_destroy, win_get_peer};
grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, char *peer_string) { grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, char *peer_string) {
grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp));

@ -118,7 +118,7 @@ struct grpc_udp_server {
/* number of pollsets in the pollsets array */ /* number of pollsets in the pollsets array */
size_t pollset_count; size_t pollset_count;
/* The parent grpc server */ /* The parent grpc server */
grpc_server* grpc_server; grpc_server *grpc_server;
}; };
grpc_udp_server *grpc_udp_server_create(void) { grpc_udp_server *grpc_udp_server_create(void) {

@ -355,8 +355,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
} }
const grpc_channel_filter grpc_client_auth_filter = { const grpc_channel_filter grpc_client_auth_filter = {
auth_start_transport_op, grpc_channel_next_op, auth_start_transport_op, grpc_channel_next_op, sizeof(call_data),
sizeof(call_data), init_call_elem, init_call_elem, destroy_call_elem, sizeof(channel_data),
destroy_call_elem, sizeof(channel_data), init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer,
init_channel_elem, destroy_channel_elem, "client-auth"};
grpc_call_next_get_peer, "client-auth"};

@ -354,9 +354,8 @@ static char *endpoint_get_peer(grpc_endpoint *secure_ep) {
} }
static const grpc_endpoint_vtable vtable = { static const grpc_endpoint_vtable vtable = {
endpoint_read, endpoint_write, endpoint_read, endpoint_write, endpoint_add_to_pollset,
endpoint_add_to_pollset, endpoint_add_to_pollset_set, endpoint_add_to_pollset_set, endpoint_shutdown, endpoint_destroy,
endpoint_shutdown, endpoint_destroy,
endpoint_get_peer}; endpoint_get_peer};
grpc_endpoint *grpc_secure_endpoint_create( grpc_endpoint *grpc_secure_endpoint_create(

@ -273,8 +273,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
} }
const grpc_channel_filter grpc_server_auth_filter = { const grpc_channel_filter grpc_server_auth_filter = {
auth_start_transport_op, grpc_channel_next_op, auth_start_transport_op, grpc_channel_next_op, sizeof(call_data),
sizeof(call_data), init_call_elem, init_call_elem, destroy_call_elem, sizeof(channel_data),
destroy_call_elem, sizeof(channel_data), init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer,
init_channel_elem, destroy_channel_elem, "server-auth"};
grpc_call_next_get_peer, "server-auth"};

@ -85,8 +85,8 @@ static void delete_key(void *key) { gpr_free(key); }
static const census_ht_option ht_opt = { static const census_ht_option ht_opt = {
CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */, CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */,
simple_hash /* hash function */, cmp_str_keys /* key comparator */, simple_hash /* hash function */, cmp_str_keys /* key comparator */,
delete_stats /* data deleter */, delete_key /* key deleter */ delete_stats /* data deleter */, delete_key /* key deleter */
}; };
static void init_rpc_stats(void *stats) { static void init_rpc_stats(void *stats) {

@ -60,11 +60,8 @@ static void delete_trace_obj(void *obj) {
} }
static const census_ht_option ht_opt = { static const census_ht_option ht_opt = {
CENSUS_HT_UINT64 /* key type */, CENSUS_HT_UINT64 /* key type */, 571 /* n_of_buckets */, NULL /* hash */,
571 /* n_of_buckets */, NULL /* compare_keys */, delete_trace_obj /* delete data */,
NULL /* hash */,
NULL /* compare_keys */,
delete_trace_obj /* delete data */,
NULL /* delete key */ NULL /* delete key */
}; };

@ -208,7 +208,8 @@ void gpr_slice_buffer_move_into(gpr_slice_buffer *src, gpr_slice_buffer *dst) {
src->length = 0; src->length = 0;
} }
void gpr_slice_buffer_trim_end(gpr_slice_buffer *sb, size_t n, gpr_slice_buffer *garbage) { void gpr_slice_buffer_trim_end(gpr_slice_buffer *sb, size_t n,
gpr_slice_buffer *garbage) {
GPR_ASSERT(n <= sb->length); GPR_ASSERT(n <= sb->length);
sb->length -= n; sb->length -= n;
for (;;) { for (;;) {

@ -133,16 +133,9 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {} grpc_channel_element *elem) {}
static const grpc_channel_filter lame_filter = { static const grpc_channel_filter lame_filter = {
lame_start_transport_stream_op, lame_start_transport_stream_op, lame_start_transport_op, sizeof(call_data),
lame_start_transport_op, init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
sizeof(call_data), destroy_channel_elem, lame_get_peer, "lame-client",
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
lame_get_peer,
"lame-client",
}; };
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1)) #define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1))

@ -767,16 +767,9 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
} }
static const grpc_channel_filter server_surface_filter = { static const grpc_channel_filter server_surface_filter = {
server_start_transport_stream_op, server_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
grpc_channel_next_op, init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
sizeof(call_data), destroy_channel_elem, grpc_call_next_get_peer, "server",
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
grpc_call_next_get_peer,
"server",
}; };
void grpc_server_register_completion_queue(grpc_server *server, void grpc_server_register_completion_queue(grpc_server *server,
@ -940,8 +933,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s,
channel = grpc_channel_create_from_filters(exec_ctx, NULL, filters, channel = grpc_channel_create_from_filters(exec_ctx, NULL, filters,
num_filters, args, mdctx, 0); num_filters, args, mdctx, 0);
chand = (channel_data *)grpc_channel_stack_element( chand = (channel_data *)grpc_channel_stack_element(
grpc_channel_get_channel_stack(channel), 0) grpc_channel_get_channel_stack(channel), 0)->channel_data;
->channel_data;
chand->server = s; chand->server = s;
server_ref(s); server_ref(s);
chand->channel = channel; chand->channel = channel;
@ -962,7 +954,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s,
method = grpc_mdstr_from_string(mdctx, rm->method); method = grpc_mdstr_from_string(mdctx, rm->method);
hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash);
for (probes = 0; chand->registered_methods[(hash + probes) % slots] for (probes = 0; chand->registered_methods[(hash + probes) % slots]
.server_registered_method != NULL; .server_registered_method != NULL;
probes++) probes++)
; ;
if (probes > max_probes) max_probes = probes; if (probes > max_probes) max_probes = probes;

@ -36,6 +36,4 @@
#include <grpc/grpc.h> #include <grpc/grpc.h>
const char *grpc_version_string(void) { const char *grpc_version_string(void) { return "0.11.0.0"; }
return "0.11.0.0";
}

@ -46,18 +46,70 @@ typedef struct {
gpr_uint8 length; gpr_uint8 length;
} b64_huff_sym; } b64_huff_sym;
static const b64_huff_sym huff_alphabet[64] = { static const b64_huff_sym huff_alphabet[64] = {{0x21, 6},
{0x21, 6}, {0x5d, 7}, {0x5e, 7}, {0x5f, 7}, {0x60, 7}, {0x61, 7}, {0x5d, 7},
{0x62, 7}, {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, {0x67, 7}, {0x5e, 7},
{0x68, 7}, {0x69, 7}, {0x6a, 7}, {0x6b, 7}, {0x6c, 7}, {0x6d, 7}, {0x5f, 7},
{0x6e, 7}, {0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7}, {0xfc, 8}, {0x60, 7},
{0x73, 7}, {0xfd, 8}, {0x3, 5}, {0x23, 6}, {0x4, 5}, {0x24, 6}, {0x61, 7},
{0x5, 5}, {0x25, 6}, {0x26, 6}, {0x27, 6}, {0x6, 5}, {0x74, 7}, {0x62, 7},
{0x75, 7}, {0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5}, {0x2b, 6}, {0x63, 7},
{0x76, 7}, {0x2c, 6}, {0x8, 5}, {0x9, 5}, {0x2d, 6}, {0x77, 7}, {0x64, 7},
{0x78, 7}, {0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x0, 5}, {0x1, 5}, {0x65, 7},
{0x2, 5}, {0x19, 6}, {0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6}, {0x66, 7},
{0x1e, 6}, {0x1f, 6}, {0x7fb, 11}, {0x18, 6}}; {0x67, 7},
{0x68, 7},
{0x69, 7},
{0x6a, 7},
{0x6b, 7},
{0x6c, 7},
{0x6d, 7},
{0x6e, 7},
{0x6f, 7},
{0x70, 7},
{0x71, 7},
{0x72, 7},
{0xfc, 8},
{0x73, 7},
{0xfd, 8},
{0x3, 5},
{0x23, 6},
{0x4, 5},
{0x24, 6},
{0x5, 5},
{0x25, 6},
{0x26, 6},
{0x27, 6},
{0x6, 5},
{0x74, 7},
{0x75, 7},
{0x28, 6},
{0x29, 6},
{0x2a, 6},
{0x7, 5},
{0x2b, 6},
{0x76, 7},
{0x2c, 6},
{0x8, 5},
{0x9, 5},
{0x2d, 6},
{0x77, 7},
{0x78, 7},
{0x79, 7},
{0x7a, 7},
{0x7b, 7},
{0x0, 5},
{0x1, 5},
{0x2, 5},
{0x19, 6},
{0x1a, 6},
{0x1b, 6},
{0x1c, 6},
{0x1d, 6},
{0x1e, 6},
{0x1f, 6},
{0x7fb, 11},
{0x18, 6}};
static const gpr_uint8 tail_xtra[3] = {0, 2, 3}; static const gpr_uint8 tail_xtra[3] = {0, 2, 3};

@ -150,12 +150,10 @@ typedef enum {
/* jump table of parse state functions -- order must match first_byte_type /* jump table of parse state functions -- order must match first_byte_type
above */ above */
static const grpc_chttp2_hpack_parser_state first_byte_action[] = { static const grpc_chttp2_hpack_parser_state first_byte_action[] = {
parse_indexed_field, parse_indexed_field_x, parse_indexed_field, parse_indexed_field_x, parse_lithdr_incidx,
parse_lithdr_incidx, parse_lithdr_incidx_x, parse_lithdr_incidx_x, parse_lithdr_incidx_v, parse_lithdr_notidx,
parse_lithdr_incidx_v, parse_lithdr_notidx, parse_lithdr_notidx_x, parse_lithdr_notidx_v, parse_lithdr_nvridx,
parse_lithdr_notidx_x, parse_lithdr_notidx_v, parse_lithdr_nvridx_x, parse_lithdr_nvridx_v, parse_max_tbl_size,
parse_lithdr_nvridx, parse_lithdr_nvridx_x,
parse_lithdr_nvridx_v, parse_max_tbl_size,
parse_max_tbl_size_x, parse_error}; parse_max_tbl_size_x, parse_error};
/* indexes the first byte to a parse state function - generated by /* indexes the first byte to a parse state function - generated by

@ -37,69 +37,261 @@
command: command:
:%s/.* \([0-9a-f]\+\) \[ *\([0-9]\+\)\]/{0x\1, \2},/g */ :%s/.* \([0-9a-f]\+\) \[ *\([0-9]\+\)\]/{0x\1, \2},/g */
const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = { const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = {
{0x1ff8, 13}, {0x7fffd8, 23}, {0xfffffe2, 28}, {0xfffffe3, 28}, {0x1ff8, 13},
{0xfffffe4, 28}, {0xfffffe5, 28}, {0xfffffe6, 28}, {0xfffffe7, 28}, {0x7fffd8, 23},
{0xfffffe8, 28}, {0xffffea, 24}, {0x3ffffffc, 30}, {0xfffffe9, 28}, {0xfffffe2, 28},
{0xfffffea, 28}, {0x3ffffffd, 30}, {0xfffffeb, 28}, {0xfffffec, 28}, {0xfffffe3, 28},
{0xfffffed, 28}, {0xfffffee, 28}, {0xfffffef, 28}, {0xffffff0, 28}, {0xfffffe4, 28},
{0xffffff1, 28}, {0xffffff2, 28}, {0x3ffffffe, 30}, {0xffffff3, 28}, {0xfffffe5, 28},
{0xffffff4, 28}, {0xffffff5, 28}, {0xffffff6, 28}, {0xffffff7, 28}, {0xfffffe6, 28},
{0xffffff8, 28}, {0xffffff9, 28}, {0xffffffa, 28}, {0xffffffb, 28}, {0xfffffe7, 28},
{0x14, 6}, {0x3f8, 10}, {0x3f9, 10}, {0xffa, 12}, {0xfffffe8, 28},
{0x1ff9, 13}, {0x15, 6}, {0xf8, 8}, {0x7fa, 11}, {0xffffea, 24},
{0x3fa, 10}, {0x3fb, 10}, {0xf9, 8}, {0x7fb, 11}, {0x3ffffffc, 30},
{0xfa, 8}, {0x16, 6}, {0x17, 6}, {0x18, 6}, {0xfffffe9, 28},
{0x0, 5}, {0x1, 5}, {0x2, 5}, {0x19, 6}, {0xfffffea, 28},
{0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6}, {0x3ffffffd, 30},
{0x1e, 6}, {0x1f, 6}, {0x5c, 7}, {0xfb, 8}, {0xfffffeb, 28},
{0x7ffc, 15}, {0x20, 6}, {0xffb, 12}, {0x3fc, 10}, {0xfffffec, 28},
{0x1ffa, 13}, {0x21, 6}, {0x5d, 7}, {0x5e, 7}, {0xfffffed, 28},
{0x5f, 7}, {0x60, 7}, {0x61, 7}, {0x62, 7}, {0xfffffee, 28},
{0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, {0xfffffef, 28},
{0x67, 7}, {0x68, 7}, {0x69, 7}, {0x6a, 7}, {0xffffff0, 28},
{0x6b, 7}, {0x6c, 7}, {0x6d, 7}, {0x6e, 7}, {0xffffff1, 28},
{0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7}, {0xffffff2, 28},
{0xfc, 8}, {0x73, 7}, {0xfd, 8}, {0x1ffb, 13}, {0x3ffffffe, 30},
{0x7fff0, 19}, {0x1ffc, 13}, {0x3ffc, 14}, {0x22, 6}, {0xffffff3, 28},
{0x7ffd, 15}, {0x3, 5}, {0x23, 6}, {0x4, 5}, {0xffffff4, 28},
{0x24, 6}, {0x5, 5}, {0x25, 6}, {0x26, 6}, {0xffffff5, 28},
{0x27, 6}, {0x6, 5}, {0x74, 7}, {0x75, 7}, {0xffffff6, 28},
{0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5}, {0xffffff7, 28},
{0x2b, 6}, {0x76, 7}, {0x2c, 6}, {0x8, 5}, {0xffffff8, 28},
{0x9, 5}, {0x2d, 6}, {0x77, 7}, {0x78, 7}, {0xffffff9, 28},
{0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x7ffe, 15}, {0xffffffa, 28},
{0x7fc, 11}, {0x3ffd, 14}, {0x1ffd, 13}, {0xffffffc, 28}, {0xffffffb, 28},
{0xfffe6, 20}, {0x3fffd2, 22}, {0xfffe7, 20}, {0xfffe8, 20}, {0x14, 6},
{0x3fffd3, 22}, {0x3fffd4, 22}, {0x3fffd5, 22}, {0x7fffd9, 23}, {0x3f8, 10},
{0x3fffd6, 22}, {0x7fffda, 23}, {0x7fffdb, 23}, {0x7fffdc, 23}, {0x3f9, 10},
{0x7fffdd, 23}, {0x7fffde, 23}, {0xffffeb, 24}, {0x7fffdf, 23}, {0xffa, 12},
{0xffffec, 24}, {0xffffed, 24}, {0x3fffd7, 22}, {0x7fffe0, 23}, {0x1ff9, 13},
{0xffffee, 24}, {0x7fffe1, 23}, {0x7fffe2, 23}, {0x7fffe3, 23}, {0x15, 6},
{0x7fffe4, 23}, {0x1fffdc, 21}, {0x3fffd8, 22}, {0x7fffe5, 23}, {0xf8, 8},
{0x3fffd9, 22}, {0x7fffe6, 23}, {0x7fffe7, 23}, {0xffffef, 24}, {0x7fa, 11},
{0x3fffda, 22}, {0x1fffdd, 21}, {0xfffe9, 20}, {0x3fffdb, 22}, {0x3fa, 10},
{0x3fffdc, 22}, {0x7fffe8, 23}, {0x7fffe9, 23}, {0x1fffde, 21}, {0x3fb, 10},
{0x7fffea, 23}, {0x3fffdd, 22}, {0x3fffde, 22}, {0xfffff0, 24}, {0xf9, 8},
{0x1fffdf, 21}, {0x3fffdf, 22}, {0x7fffeb, 23}, {0x7fffec, 23}, {0x7fb, 11},
{0x1fffe0, 21}, {0x1fffe1, 21}, {0x3fffe0, 22}, {0x1fffe2, 21}, {0xfa, 8},
{0x7fffed, 23}, {0x3fffe1, 22}, {0x7fffee, 23}, {0x7fffef, 23}, {0x16, 6},
{0xfffea, 20}, {0x3fffe2, 22}, {0x3fffe3, 22}, {0x3fffe4, 22}, {0x17, 6},
{0x7ffff0, 23}, {0x3fffe5, 22}, {0x3fffe6, 22}, {0x7ffff1, 23}, {0x18, 6},
{0x3ffffe0, 26}, {0x3ffffe1, 26}, {0xfffeb, 20}, {0x7fff1, 19}, {0x0, 5},
{0x3fffe7, 22}, {0x7ffff2, 23}, {0x3fffe8, 22}, {0x1ffffec, 25}, {0x1, 5},
{0x3ffffe2, 26}, {0x3ffffe3, 26}, {0x3ffffe4, 26}, {0x7ffffde, 27}, {0x2, 5},
{0x7ffffdf, 27}, {0x3ffffe5, 26}, {0xfffff1, 24}, {0x1ffffed, 25}, {0x19, 6},
{0x7fff2, 19}, {0x1fffe3, 21}, {0x3ffffe6, 26}, {0x7ffffe0, 27}, {0x1a, 6},
{0x7ffffe1, 27}, {0x3ffffe7, 26}, {0x7ffffe2, 27}, {0xfffff2, 24}, {0x1b, 6},
{0x1fffe4, 21}, {0x1fffe5, 21}, {0x3ffffe8, 26}, {0x3ffffe9, 26}, {0x1c, 6},
{0xffffffd, 28}, {0x7ffffe3, 27}, {0x7ffffe4, 27}, {0x7ffffe5, 27}, {0x1d, 6},
{0xfffec, 20}, {0xfffff3, 24}, {0xfffed, 20}, {0x1fffe6, 21}, {0x1e, 6},
{0x3fffe9, 22}, {0x1fffe7, 21}, {0x1fffe8, 21}, {0x7ffff3, 23}, {0x1f, 6},
{0x3fffea, 22}, {0x3fffeb, 22}, {0x1ffffee, 25}, {0x1ffffef, 25}, {0x5c, 7},
{0xfffff4, 24}, {0xfffff5, 24}, {0x3ffffea, 26}, {0x7ffff4, 23}, {0xfb, 8},
{0x3ffffeb, 26}, {0x7ffffe6, 27}, {0x3ffffec, 26}, {0x3ffffed, 26}, {0x7ffc, 15},
{0x7ffffe7, 27}, {0x7ffffe8, 27}, {0x7ffffe9, 27}, {0x7ffffea, 27}, {0x20, 6},
{0x7ffffeb, 27}, {0xffffffe, 28}, {0x7ffffec, 27}, {0x7ffffed, 27}, {0xffb, 12},
{0x7ffffee, 27}, {0x7ffffef, 27}, {0x7fffff0, 27}, {0x3ffffee, 26}, {0x3fc, 10},
{0x1ffa, 13},
{0x21, 6},
{0x5d, 7},
{0x5e, 7},
{0x5f, 7},
{0x60, 7},
{0x61, 7},
{0x62, 7},
{0x63, 7},
{0x64, 7},
{0x65, 7},
{0x66, 7},
{0x67, 7},
{0x68, 7},
{0x69, 7},
{0x6a, 7},
{0x6b, 7},
{0x6c, 7},
{0x6d, 7},
{0x6e, 7},
{0x6f, 7},
{0x70, 7},
{0x71, 7},
{0x72, 7},
{0xfc, 8},
{0x73, 7},
{0xfd, 8},
{0x1ffb, 13},
{0x7fff0, 19},
{0x1ffc, 13},
{0x3ffc, 14},
{0x22, 6},
{0x7ffd, 15},
{0x3, 5},
{0x23, 6},
{0x4, 5},
{0x24, 6},
{0x5, 5},
{0x25, 6},
{0x26, 6},
{0x27, 6},
{0x6, 5},
{0x74, 7},
{0x75, 7},
{0x28, 6},
{0x29, 6},
{0x2a, 6},
{0x7, 5},
{0x2b, 6},
{0x76, 7},
{0x2c, 6},
{0x8, 5},
{0x9, 5},
{0x2d, 6},
{0x77, 7},
{0x78, 7},
{0x79, 7},
{0x7a, 7},
{0x7b, 7},
{0x7ffe, 15},
{0x7fc, 11},
{0x3ffd, 14},
{0x1ffd, 13},
{0xffffffc, 28},
{0xfffe6, 20},
{0x3fffd2, 22},
{0xfffe7, 20},
{0xfffe8, 20},
{0x3fffd3, 22},
{0x3fffd4, 22},
{0x3fffd5, 22},
{0x7fffd9, 23},
{0x3fffd6, 22},
{0x7fffda, 23},
{0x7fffdb, 23},
{0x7fffdc, 23},
{0x7fffdd, 23},
{0x7fffde, 23},
{0xffffeb, 24},
{0x7fffdf, 23},
{0xffffec, 24},
{0xffffed, 24},
{0x3fffd7, 22},
{0x7fffe0, 23},
{0xffffee, 24},
{0x7fffe1, 23},
{0x7fffe2, 23},
{0x7fffe3, 23},
{0x7fffe4, 23},
{0x1fffdc, 21},
{0x3fffd8, 22},
{0x7fffe5, 23},
{0x3fffd9, 22},
{0x7fffe6, 23},
{0x7fffe7, 23},
{0xffffef, 24},
{0x3fffda, 22},
{0x1fffdd, 21},
{0xfffe9, 20},
{0x3fffdb, 22},
{0x3fffdc, 22},
{0x7fffe8, 23},
{0x7fffe9, 23},
{0x1fffde, 21},
{0x7fffea, 23},
{0x3fffdd, 22},
{0x3fffde, 22},
{0xfffff0, 24},
{0x1fffdf, 21},
{0x3fffdf, 22},
{0x7fffeb, 23},
{0x7fffec, 23},
{0x1fffe0, 21},
{0x1fffe1, 21},
{0x3fffe0, 22},
{0x1fffe2, 21},
{0x7fffed, 23},
{0x3fffe1, 22},
{0x7fffee, 23},
{0x7fffef, 23},
{0xfffea, 20},
{0x3fffe2, 22},
{0x3fffe3, 22},
{0x3fffe4, 22},
{0x7ffff0, 23},
{0x3fffe5, 22},
{0x3fffe6, 22},
{0x7ffff1, 23},
{0x3ffffe0, 26},
{0x3ffffe1, 26},
{0xfffeb, 20},
{0x7fff1, 19},
{0x3fffe7, 22},
{0x7ffff2, 23},
{0x3fffe8, 22},
{0x1ffffec, 25},
{0x3ffffe2, 26},
{0x3ffffe3, 26},
{0x3ffffe4, 26},
{0x7ffffde, 27},
{0x7ffffdf, 27},
{0x3ffffe5, 26},
{0xfffff1, 24},
{0x1ffffed, 25},
{0x7fff2, 19},
{0x1fffe3, 21},
{0x3ffffe6, 26},
{0x7ffffe0, 27},
{0x7ffffe1, 27},
{0x3ffffe7, 26},
{0x7ffffe2, 27},
{0xfffff2, 24},
{0x1fffe4, 21},
{0x1fffe5, 21},
{0x3ffffe8, 26},
{0x3ffffe9, 26},
{0xffffffd, 28},
{0x7ffffe3, 27},
{0x7ffffe4, 27},
{0x7ffffe5, 27},
{0xfffec, 20},
{0xfffff3, 24},
{0xfffed, 20},
{0x1fffe6, 21},
{0x3fffe9, 22},
{0x1fffe7, 21},
{0x1fffe8, 21},
{0x7ffff3, 23},
{0x3fffea, 22},
{0x3fffeb, 22},
{0x1ffffee, 25},
{0x1ffffef, 25},
{0xfffff4, 24},
{0xfffff5, 24},
{0x3ffffea, 26},
{0x7ffff4, 23},
{0x3ffffeb, 26},
{0x7ffffe6, 27},
{0x3ffffec, 26},
{0x3ffffed, 26},
{0x7ffffe7, 27},
{0x7ffffe8, 27},
{0x7ffffe9, 27},
{0x7ffffea, 27},
{0x7ffffeb, 27},
{0xffffffe, 28},
{0x7ffffec, 27},
{0x7ffffed, 27},
{0x7ffffee, 27},
{0x7ffffef, 27},
{0x7fffff0, 27},
{0x3ffffee, 26},
{0x3fffffff, 30}, {0x3fffffff, 30},
}; };

@ -278,7 +278,7 @@ static void emit_indexed(grpc_chttp2_hpack_compressor *c, gpr_uint32 elem_index,
framer_state *st) { framer_state *st) {
gpr_uint32 len = GRPC_CHTTP2_VARINT_LENGTH(elem_index, 1); gpr_uint32 len = GRPC_CHTTP2_VARINT_LENGTH(elem_index, 1);
GRPC_CHTTP2_WRITE_VARINT(elem_index, 1, 0x80, add_tiny_header_data(st, len), GRPC_CHTTP2_WRITE_VARINT(elem_index, 1, 0x80, add_tiny_header_data(st, len),
len); len);
} }
static gpr_slice get_wire_value(grpc_mdelem *elem, gpr_uint8 *huffman_prefix) { static gpr_slice get_wire_value(grpc_mdelem *elem, gpr_uint8 *huffman_prefix) {
@ -365,7 +365,7 @@ static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c,
} }
static gpr_uint32 dynidx(grpc_chttp2_hpack_compressor *c, static gpr_uint32 dynidx(grpc_chttp2_hpack_compressor *c,
gpr_uint32 elem_index) { gpr_uint32 elem_index) {
return 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY + c->tail_remote_index + return 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY + c->tail_remote_index +
c->table_elems - elem_index; c->table_elems - elem_index;
} }

@ -1114,8 +1114,8 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, int success) {
grpc_chttp2_prepare_to_read(&t->global, &t->parsing); grpc_chttp2_prepare_to_read(&t->global, &t->parsing);
gpr_mu_unlock(&t->mu); gpr_mu_unlock(&t->mu);
for (; i < t->read_buffer.count && for (; i < t->read_buffer.count &&
grpc_chttp2_perform_read(exec_ctx, &t->parsing, grpc_chttp2_perform_read(exec_ctx, &t->parsing,
t->read_buffer.slices[i]); t->read_buffer.slices[i]);
i++) i++)
; ;
gpr_mu_lock(&t->mu); gpr_mu_lock(&t->mu);
@ -1229,13 +1229,9 @@ static char *chttp2_get_peer(grpc_exec_ctx *exec_ctx, grpc_transport *t) {
return gpr_strdup(((grpc_chttp2_transport *)t)->peer_string); return gpr_strdup(((grpc_chttp2_transport *)t)->peer_string);
} }
static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream), static const grpc_transport_vtable vtable = {
init_stream, sizeof(grpc_chttp2_stream), init_stream, perform_stream_op,
perform_stream_op, perform_transport_op, destroy_stream, destroy_transport, chttp2_get_peer};
perform_transport_op,
destroy_stream,
destroy_transport,
chttp2_get_peer};
grpc_transport *grpc_create_chttp2_transport( grpc_transport *grpc_create_chttp2_transport(
grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args, grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args,

@ -493,10 +493,8 @@ static void fake_handshaker_destroy(tsi_handshaker *self) {
static const tsi_handshaker_vtable handshaker_vtable = { static const tsi_handshaker_vtable handshaker_vtable = {
fake_handshaker_get_bytes_to_send_to_peer, fake_handshaker_get_bytes_to_send_to_peer,
fake_handshaker_process_bytes_from_peer, fake_handshaker_process_bytes_from_peer, fake_handshaker_get_result,
fake_handshaker_get_result, fake_handshaker_extract_peer, fake_handshaker_create_frame_protector,
fake_handshaker_extract_peer,
fake_handshaker_create_frame_protector,
fake_handshaker_destroy, fake_handshaker_destroy,
}; };

@ -976,10 +976,8 @@ static void ssl_handshaker_destroy(tsi_handshaker *self) {
static const tsi_handshaker_vtable handshaker_vtable = { static const tsi_handshaker_vtable handshaker_vtable = {
ssl_handshaker_get_bytes_to_send_to_peer, ssl_handshaker_get_bytes_to_send_to_peer,
ssl_handshaker_process_bytes_from_peer, ssl_handshaker_process_bytes_from_peer, ssl_handshaker_get_result,
ssl_handshaker_get_result, ssl_handshaker_extract_peer, ssl_handshaker_create_frame_protector,
ssl_handshaker_extract_peer,
ssl_handshaker_create_frame_protector,
ssl_handshaker_destroy, ssl_handshaker_destroy,
}; };

@ -161,7 +161,8 @@ Status SerializeProto(const grpc::protobuf::Message& msg,
int byte_size = msg.ByteSize(); int byte_size = msg.ByteSize();
if (byte_size <= kMaxBufferLength) { if (byte_size <= kMaxBufferLength) {
gpr_slice slice = gpr_slice_malloc(byte_size); gpr_slice slice = gpr_slice_malloc(byte_size);
GPR_ASSERT(GPR_SLICE_END_PTR(slice) == msg.SerializeWithCachedSizesToArray(GPR_SLICE_START_PTR(slice))); GPR_ASSERT(GPR_SLICE_END_PTR(slice) ==
msg.SerializeWithCachedSizesToArray(GPR_SLICE_START_PTR(slice)));
*bp = grpc_raw_byte_buffer_create(&slice, 1); *bp = grpc_raw_byte_buffer_create(&slice, 1);
gpr_slice_unref(slice); gpr_slice_unref(slice);
return Status::OK; return Status::OK;

@ -35,7 +35,6 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include "src/cpp/common/secure_auth_context.h" #include "src/cpp/common/secure_auth_context.h"
#include "src/cpp/server/secure_server_credentials.h" #include "src/cpp/server/secure_server_credentials.h"
@ -43,7 +42,7 @@
namespace grpc { namespace grpc {
void AuthMetadataProcessorAyncWrapper::Destroy(void *wrapper) { void AuthMetadataProcessorAyncWrapper::Destroy(void* wrapper) {
auto* w = reinterpret_cast<AuthMetadataProcessorAyncWrapper*>(wrapper); auto* w = reinterpret_cast<AuthMetadataProcessorAyncWrapper*>(wrapper);
delete w; delete w;
} }
@ -68,8 +67,7 @@ void AuthMetadataProcessorAyncWrapper::Process(
} }
void AuthMetadataProcessorAyncWrapper::InvokeProcessor( void AuthMetadataProcessorAyncWrapper::InvokeProcessor(
grpc_auth_context* ctx, grpc_auth_context* ctx, const grpc_metadata* md, size_t num_md,
const grpc_metadata* md, size_t num_md,
grpc_process_auth_metadata_done_cb cb, void* user_data) { grpc_process_auth_metadata_done_cb cb, void* user_data) {
AuthMetadataProcessor::InputMetadata metadata; AuthMetadataProcessor::InputMetadata metadata;
for (size_t i = 0; i < num_md; i++) { for (size_t i = 0; i < num_md; i++) {
@ -117,7 +115,7 @@ int SecureServerCredentials::AddPortToServer(const grpc::string& addr,
void SecureServerCredentials::SetAuthMetadataProcessor( void SecureServerCredentials::SetAuthMetadataProcessor(
const std::shared_ptr<AuthMetadataProcessor>& processor) { const std::shared_ptr<AuthMetadataProcessor>& processor) {
auto *wrapper = new AuthMetadataProcessorAyncWrapper(processor); auto* wrapper = new AuthMetadataProcessorAyncWrapper(processor);
grpc_server_credentials_set_auth_metadata_processor( grpc_server_credentials_set_auth_metadata_processor(
creds_, {AuthMetadataProcessorAyncWrapper::Process, creds_, {AuthMetadataProcessorAyncWrapper::Process,
AuthMetadataProcessorAyncWrapper::Destroy, wrapper}); AuthMetadataProcessorAyncWrapper::Destroy, wrapper});

@ -325,7 +325,7 @@ bool Server::RegisterAsyncService(const grpc::string* host,
GPR_ASSERT(service->server_ == nullptr && GPR_ASSERT(service->server_ == nullptr &&
"Can only register an asynchronous service against one server."); "Can only register an asynchronous service against one server.");
service->server_ = this; service->server_ = this;
service->request_args_ = new void*[service->method_count_]; service->request_args_ = new void* [service->method_count_];
for (size_t i = 0; i < service->method_count_; ++i) { for (size_t i = 0; i < service->method_count_; ++i) {
void* tag = grpc_server_register_method(server_, service->method_names_[i], void* tag = grpc_server_register_method(server_, service->method_names_[i],
host ? host->c_str() : nullptr); host ? host->c_str() : nullptr);

@ -44,7 +44,7 @@ namespace grpc {
ServerBuilder::ServerBuilder() ServerBuilder::ServerBuilder()
: max_message_size_(-1), generic_service_(nullptr), thread_pool_(nullptr) { : max_message_size_(-1), generic_service_(nullptr), thread_pool_(nullptr) {
grpc_compression_options_init(&compression_options_); grpc_compression_options_init(&compression_options_);
} }
std::unique_ptr<ServerCompletionQueue> ServerBuilder::AddCompletionQueue() { std::unique_ptr<ServerCompletionQueue> ServerBuilder::AddCompletionQueue() {

@ -85,29 +85,17 @@ size_t string_ref::find(char c) const {
return it == cend() ? npos : std::distance(cbegin(), it); return it == cend() ? npos : std::distance(cbegin(), it);
} }
bool operator==(string_ref x, string_ref y) { bool operator==(string_ref x, string_ref y) { return x.compare(y) == 0; }
return x.compare(y) == 0;
}
bool operator!=(string_ref x, string_ref y) { bool operator!=(string_ref x, string_ref y) { return x.compare(y) != 0; }
return x.compare(y) != 0;
}
bool operator<(string_ref x, string_ref y) { bool operator<(string_ref x, string_ref y) { return x.compare(y) < 0; }
return x.compare(y) < 0;
}
bool operator<=(string_ref x, string_ref y) { bool operator<=(string_ref x, string_ref y) { return x.compare(y) <= 0; }
return x.compare(y) <= 0;
}
bool operator>(string_ref x, string_ref y) { bool operator>(string_ref x, string_ref y) { return x.compare(y) > 0; }
return x.compare(y) > 0;
}
bool operator>=(string_ref x, string_ref y) { bool operator>=(string_ref x, string_ref y) { return x.compare(y) >= 0; }
return x.compare(y) >= 0;
}
std::ostream& operator<<(std::ostream& out, const string_ref& string) { std::ostream& operator<<(std::ostream& out, const string_ref& string) {
return out << grpc::string(string.begin(), string.end()); return out << grpc::string(string.begin(), string.end());

@ -157,9 +157,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator,
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_server_shutdown_and_notify(a.server, a.cq, NULL); grpc_server_shutdown_and_notify(a.server, a.cq, NULL);
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL,
a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(a.server); grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq); grpc_completion_queue_destroy(a.cq);
gpr_slice_buffer_destroy(&outgoing); gpr_slice_buffer_destroy(&outgoing);

@ -36,9 +36,9 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) { static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) { while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next( GPR_ASSERT(grpc_completion_queue_next(cq,
cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),
.type == GRPC_QUEUE_TIMEOUT); NULL).type == GRPC_QUEUE_TIMEOUT);
} }
} }

@ -38,9 +38,9 @@
static void verifier(grpc_server *server, grpc_completion_queue *cq) { static void verifier(grpc_server *server, grpc_completion_queue *cq) {
while (grpc_server_has_open_connections(server)) { while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next( GPR_ASSERT(grpc_completion_queue_next(cq,
cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20),
.type == GRPC_QUEUE_TIMEOUT); NULL).type == GRPC_QUEUE_TIMEOUT);
} }
} }

@ -85,11 +85,10 @@ static char *get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
} }
static void test_create_channel_stack(void) { static void test_create_channel_stack(void) {
const grpc_channel_filter filter = {call_func, channel_func, const grpc_channel_filter filter = {
sizeof(int), call_init_func, call_func, channel_func, sizeof(int), call_init_func, call_destroy_func,
call_destroy_func, sizeof(int), sizeof(int), channel_init_func, channel_destroy_func, get_peer,
channel_init_func, channel_destroy_func, "some_test_filter"};
get_peer, "some_test_filter"};
const grpc_channel_filter *filters = &filter; const grpc_channel_filter *filters = &filter;
grpc_channel_stack *channel_stack; grpc_channel_stack *channel_stack;
grpc_call_stack *call_stack; grpc_call_stack *call_stack;

@ -134,9 +134,9 @@ static void kill_server(const servers_fixture *f, size_t i) {
gpr_log(GPR_INFO, "KILLING SERVER %d", i); gpr_log(GPR_INFO, "KILLING SERVER %d", i);
GPR_ASSERT(f->servers[i] != NULL); GPR_ASSERT(f->servers[i] != NULL);
grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000),
f->cq, tag(10000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->servers[i]); grpc_server_destroy(f->servers[i]);
f->servers[i] = NULL; f->servers[i] = NULL;
} }
@ -190,9 +190,9 @@ static void teardown_servers(servers_fixture *f) {
for (i = 0; i < f->num_servers; i++) { for (i = 0; i < f->num_servers; i++) {
if (f->servers[i] == NULL) continue; if (f->servers[i] == NULL) continue;
grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000),
f->cq, tag(10000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->servers[i]); grpc_server_destroy(f->servers[i]);
} }
grpc_completion_queue_shutdown(f->cq); grpc_completion_queue_shutdown(f->cq);
@ -307,8 +307,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client,
s_idx = -1; s_idx = -1;
while ((ev = grpc_completion_queue_next( while ((ev = grpc_completion_queue_next(
f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)) f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)).type !=
.type != GRPC_QUEUE_TIMEOUT) { GRPC_QUEUE_TIMEOUT) {
read_tag = ((int)(gpr_intptr)ev.tag); read_tag = ((int)(gpr_intptr)ev.tag);
gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d", gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d",
ev.success, ev.type, read_tag, iter_num); ev.success, ev.type, read_tag, iter_num);

@ -249,9 +249,9 @@ void test_connect(const char *server_host, const char *client_host, int port,
/* Destroy server. */ /* Destroy server. */
grpc_server_shutdown_and_notify(server, cq, tag(1000)); grpc_server_shutdown_and_notify(server, cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(cq, tag(1000),
cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(server); grpc_server_destroy(server);
grpc_completion_queue_shutdown(cq); grpc_completion_queue_shutdown(cq);
drain_cq(cq); drain_cq(cq);

@ -88,9 +88,8 @@ int main(int argc, char **argv) {
GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED);
grpc_completion_queue_shutdown(cq); grpc_completion_queue_shutdown(cq);
while ( while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME),
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) NULL).type != GRPC_QUEUE_SHUTDOWN)
.type != GRPC_QUEUE_SHUTDOWN)
; ;
grpc_completion_queue_destroy(cq); grpc_completion_queue_destroy(cq);
grpc_call_destroy(call); grpc_call_destroy(call);

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -93,9 +93,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -66,9 +66,9 @@ static void *tag(gpr_intptr t) { return (void *)t; }
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -51,9 +51,10 @@ typedef struct {
static void child_thread(void *arg) { static void child_thread(void *arg) {
child_events *ce = arg; child_events *ce = arg;
grpc_event ev; grpc_event ev;
gpr_event_set(&ce->started, (void*)1); gpr_event_set(&ce->started, (void *)1);
gpr_log(GPR_DEBUG, "verifying"); gpr_log(GPR_DEBUG, "verifying");
ev = grpc_completion_queue_next(ce->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); ev = grpc_completion_queue_next(ce->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC),
NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
GPR_ASSERT(ev.tag == tag(1)); GPR_ASSERT(ev.tag == tag(1));
GPR_ASSERT(ev.success == 0); GPR_ASSERT(ev.success == 0);
@ -86,9 +87,8 @@ static void test_connectivity(grpc_end2end_test_config config) {
/* start watching for a change */ /* start watching for a change */
gpr_log(GPR_DEBUG, "watching"); gpr_log(GPR_DEBUG, "watching");
grpc_channel_watch_connectivity_state(f.client, GRPC_CHANNEL_IDLE, grpc_channel_watch_connectivity_state(
gpr_now(GPR_CLOCK_MONOTONIC), f.client, GRPC_CHANNEL_IDLE, gpr_now(GPR_CLOCK_MONOTONIC), f.cq, tag(1));
f.cq, tag(1));
/* eventually the child thread completion should trigger */ /* eventually the child thread completion should trigger */
gpr_thd_join(thdid); gpr_thd_join(thdid);

@ -80,9 +80,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -73,9 +73,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -63,9 +63,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) {
static void shutdown_server(grpc_end2end_test_fixture *f) { static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return; if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck( GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000),
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5),
.type == GRPC_OP_COMPLETE); NULL).type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server); grpc_server_destroy(f->server);
f->server = NULL; f->server = NULL;
} }

@ -142,7 +142,8 @@ static void test_format_post_request_content_type_override(void) {
"POST /index.html HTTP/1.0\r\n" "POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n" "Host: example.com\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"User-Agent: " GRPC_HTTPCLI_USER_AGENT "\r\n" "User-Agent: " GRPC_HTTPCLI_USER_AGENT
"\r\n"
"x-yz: abc\r\n" "x-yz: abc\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n" "Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: 11\r\n" "Content-Length: 11\r\n"

@ -66,7 +66,7 @@ static testing_pair testing_pairs[] = {
{"\"\\ud834\\udd1e\"", "\"\\ud834\\udd1e\""}, {"\"\\ud834\\udd1e\"", "\"\\ud834\\udd1e\""},
/* Testing nested empty containers. */ /* Testing nested empty containers. */
{ {
" [ [ ] , { } , [ ] ] ", "[[],{},[]]", " [ [ ] , { } , [ ] ] ", "[[],{},[]]",
}, },
/* Testing escapes and control chars in key strings. */ /* Testing escapes and control chars in key strings. */
{" { \"\x7f\\n\\\\a , b\": 1, \"\": 0 } ", {" { \"\x7f\\n\\\\a , b\": 1, \"\": 0 } ",

@ -65,8 +65,8 @@ static void free_data(void *data) { gpr_free(data); }
static void test_create_table(void) { static void test_create_table(void) {
/* Create table with uint64 key type */ /* Create table with uint64 key type */
census_ht *ht = NULL; census_ht *ht = NULL;
census_ht_option ht_options = { census_ht_option ht_options = {CENSUS_HT_UINT64, 1999, NULL, NULL, NULL,
CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, NULL}; NULL};
ht = census_ht_create(&ht_options); ht = census_ht_create(&ht_options);
GPR_ASSERT(ht != NULL); GPR_ASSERT(ht != NULL);
GPR_ASSERT(census_ht_get_size(ht) == 0); GPR_ASSERT(census_ht_get_size(ht) == 0);
@ -120,8 +120,8 @@ static void test_table_with_int_key(void) {
/* Test that there is no memory leak when keys and values are owned by table. */ /* Test that there is no memory leak when keys and values are owned by table. */
static void test_value_and_key_deleter(void) { static void test_value_and_key_deleter(void) {
census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys,
&cmp_str_keys, &free_data, &free_data}; &free_data, &free_data};
census_ht *ht = census_ht_create(&opt); census_ht *ht = census_ht_create(&opt);
census_ht_key key; census_ht_key key;
char *val = NULL; char *val = NULL;
@ -185,8 +185,8 @@ static void test_simple_add_and_erase(void) {
} }
static void test_insertion_and_deletion_with_high_collision_rate(void) { static void test_insertion_and_deletion_with_high_collision_rate(void) {
census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision, census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision,
&cmp_str_keys, NULL, NULL}; &cmp_str_keys, NULL, NULL};
census_ht *ht = census_ht_create(&opt); census_ht *ht = census_ht_create(&opt);
char key_str[1000][GPR_LTOA_MIN_BUFSIZE]; char key_str[1000][GPR_LTOA_MIN_BUFSIZE];
gpr_uint64 val = 0; gpr_uint64 val = 0;
@ -209,12 +209,12 @@ static void test_insertion_and_deletion_with_high_collision_rate(void) {
} }
static void test_table_with_string_key(void) { static void test_table_with_string_key(void) {
census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys, NULL,
&cmp_str_keys, NULL, NULL}; NULL};
census_ht *ht = census_ht_create(&opt); census_ht *ht = census_ht_create(&opt);
const char *keys[] = { const char *keys[] = {"k1", "a", "000", "apple",
"k1", "a", "000", "apple", "banana_a_long_long_long_banana", "banana_a_long_long_long_banana", "%$", "111", "foo",
"%$", "111", "foo", "b"}; "b"};
const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
int i = 0; int i = 0;
GPR_ASSERT(ht != NULL); GPR_ASSERT(ht != NULL);

@ -193,7 +193,6 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll"; const char TestAuthMetadataProcessor::kGoodGuy[] = "Dr Jekyll";
const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity"; const char TestAuthMetadataProcessor::kIdentityPropName[] = "novel identity";
class Proxy : public ::grpc::cpp::test::util::TestService::Service { class Proxy : public ::grpc::cpp::test::util::TestService::Service {
public: public:
Proxy(std::shared_ptr<Channel> channel) Proxy(std::shared_ptr<Channel> channel)
@ -259,7 +258,8 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
if (request->has_param() && if (request->has_param() &&
(request->param().expected_client_identity().length() > 0 || (request->param().expected_client_identity().length() > 0 ||
request->param().check_auth_context())) { request->param().check_auth_context())) {
CheckServerAuthContext(context, request->param().expected_client_identity()); CheckServerAuthContext(context,
request->param().expected_client_identity());
} }
if (request->has_param() && if (request->has_param() &&
request->param().response_message_length() > 0) { request->param().response_message_length() > 0) {

@ -58,57 +58,60 @@ using grpc::cpp::test::util::EchoRequest;
using grpc::cpp::test::util::EchoResponse; using grpc::cpp::test::util::EchoResponse;
using std::chrono::system_clock; using std::chrono::system_clock;
const char* kLargeString = "(" const char* kLargeString =
"To be, or not to be- that is the question:" "("
"Whether 'tis nobler in the mind to suffer" "To be, or not to be- that is the question:"
"The slings and arrows of outrageous fortune" "Whether 'tis nobler in the mind to suffer"
"Or to take arms against a sea of troubles," "The slings and arrows of outrageous fortune"
"And by opposing end them. To die- to sleep-" "Or to take arms against a sea of troubles,"
"No more; and by a sleep to say we end" "And by opposing end them. To die- to sleep-"
"The heartache, and the thousand natural shock" "No more; and by a sleep to say we end"
"That flesh is heir to. 'Tis a consummation" "The heartache, and the thousand natural shock"
"Devoutly to be wish'd. To die- to sleep." "That flesh is heir to. 'Tis a consummation"
"To sleep- perchance to dream: ay, there's the rub!" "Devoutly to be wish'd. To die- to sleep."
"For in that sleep of death what dreams may come" "To sleep- perchance to dream: ay, there's the rub!"
"When we have shuffled off this mortal coil," "For in that sleep of death what dreams may come"
"Must give us pause. There's the respect" "When we have shuffled off this mortal coil,"
"That makes calamity of so long life." "Must give us pause. There's the respect"
"For who would bear the whips and scorns of time," "That makes calamity of so long life."
"Th' oppressor's wrong, the proud man's contumely," "For who would bear the whips and scorns of time,"
"The pangs of despis'd love, the law's delay," "Th' oppressor's wrong, the proud man's contumely,"
"The insolence of office, and the spurns" "The pangs of despis'd love, the law's delay,"
"That patient merit of th' unworthy takes," "The insolence of office, and the spurns"
"When he himself might his quietus make" "That patient merit of th' unworthy takes,"
"With a bare bodkin? Who would these fardels bear," "When he himself might his quietus make"
"To grunt and sweat under a weary life," "With a bare bodkin? Who would these fardels bear,"
"But that the dread of something after death-" "To grunt and sweat under a weary life,"
"The undiscover'd country, from whose bourn" "But that the dread of something after death-"
"No traveller returns- puzzles the will," "The undiscover'd country, from whose bourn"
"And makes us rather bear those ills we have" "No traveller returns- puzzles the will,"
"Than fly to others that we know not of?" "And makes us rather bear those ills we have"
"Thus conscience does make cowards of us all," "Than fly to others that we know not of?"
"And thus the native hue of resolution" "Thus conscience does make cowards of us all,"
"Is sicklied o'er with the pale cast of thought," "And thus the native hue of resolution"
"And enterprises of great pith and moment" "Is sicklied o'er with the pale cast of thought,"
"With this regard their currents turn awry" "And enterprises of great pith and moment"
"And lose the name of action.- Soft you now!" "With this regard their currents turn awry"
"The fair Ophelia!- Nymph, in thy orisons" "And lose the name of action.- Soft you now!"
"Be all my sins rememb'red."; "The fair Ophelia!- Nymph, in thy orisons"
"Be all my sins rememb'red.";
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
public: public:
static void BidiStream_Sender(ServerReaderWriter<EchoResponse, EchoRequest>* stream, gpr_atm* should_exit) { static void BidiStream_Sender(
ServerReaderWriter<EchoResponse, EchoRequest>* stream,
gpr_atm* should_exit) {
EchoResponse response; EchoResponse response;
response.set_message(kLargeString); response.set_message(kLargeString);
while (gpr_atm_acq_load(should_exit) == static_cast<gpr_atm>(0)) { while (gpr_atm_acq_load(should_exit) == static_cast<gpr_atm>(0)) {
struct timespec tv = {0, 1000000}; // 1 ms struct timespec tv = {0, 1000000}; // 1 ms
struct timespec rem; struct timespec rem;
// TODO (vpai): Mark this blocking // TODO (vpai): Mark this blocking
while (nanosleep(&tv, &rem) != 0) { while (nanosleep(&tv, &rem) != 0) {
tv = rem; tv = rem;
}; };
stream->Write(response); stream->Write(response);
@ -123,14 +126,15 @@ class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service {
gpr_atm should_exit; gpr_atm should_exit;
gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(0)); gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(0));
std::thread sender(std::bind(&TestServiceImpl::BidiStream_Sender, stream, &should_exit)); std::thread sender(
std::bind(&TestServiceImpl::BidiStream_Sender, stream, &should_exit));
while (stream->Read(&request)) { while (stream->Read(&request)) {
struct timespec tv = {0, 3000000}; // 3 ms struct timespec tv = {0, 3000000}; // 3 ms
struct timespec rem; struct timespec rem;
// TODO (vpai): Mark this blocking // TODO (vpai): Mark this blocking
while (nanosleep(&tv, &rem) != 0) { while (nanosleep(&tv, &rem) != 0) {
tv = rem; tv = rem;
}; };
} }
gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(1)); gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(1));
@ -155,8 +159,8 @@ class End2endTest : public ::testing::Test {
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void TearDown() GRPC_OVERRIDE { server_->Shutdown(); }
void ResetStub() { void ResetStub() {
std::shared_ptr<Channel> channel = CreateChannel( std::shared_ptr<Channel> channel =
server_address_.str(), InsecureCredentials()); CreateChannel(server_address_.str(), InsecureCredentials());
stub_ = grpc::cpp::test::util::TestService::NewStub(channel); stub_ = grpc::cpp::test::util::TestService::NewStub(channel);
} }
@ -169,7 +173,7 @@ class End2endTest : public ::testing::Test {
static void Drainer(ClientReaderWriter<EchoRequest, EchoResponse>* reader) { static void Drainer(ClientReaderWriter<EchoRequest, EchoResponse>* reader) {
EchoResponse response; EchoResponse response;
while (reader->Read(&response)) { while (reader->Read(&response)) {
// Just drain out the responses as fast as possible. // Just drain out the responses as fast as possible.
} }
} }

@ -146,8 +146,8 @@ int main(int argc, char** argv) {
if (FLAGS_enable_ssl) { if (FLAGS_enable_ssl) {
grpc::string json_key = GetServiceAccountJsonKey(); grpc::string json_key = GetServiceAccountJsonKey();
client.DoJwtTokenCreds(json_key); client.DoJwtTokenCreds(json_key);
client.DoOauth2AuthToken( client.DoOauth2AuthToken(FLAGS_default_service_account,
FLAGS_default_service_account, FLAGS_oauth_scope); FLAGS_oauth_scope);
client.DoPerRpcCreds(json_key); client.DoPerRpcCreds(json_key);
} }
// compute_engine_creds only runs in GCE. // compute_engine_creds only runs in GCE.

@ -203,8 +203,7 @@ void InteropClient::DoOauth2AuthToken(const grpc::string& username,
} }
void InteropClient::DoPerRpcCreds(const grpc::string& json_key) { void InteropClient::DoPerRpcCreds(const grpc::string& json_key) {
gpr_log(GPR_INFO, gpr_log(GPR_INFO, "Sending a unary rpc with per-rpc JWT access token ...");
"Sending a unary rpc with per-rpc JWT access token ...");
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.set_fill_username(true); request.set_fill_username(true);

@ -55,7 +55,6 @@ extern "C" {
#include "src/core/support/string.h" #include "src/core/support/string.h"
} }
int test_client(const char* root, const char* host, int port) { int test_client(const char* root, const char* host, int port) {
int status; int status;
pid_t cli; pid_t cli;

@ -153,8 +153,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor // where class contained in std::vector must have a copy constructor
auto* servers = new ServerData[num_servers]; auto* servers = new ServerData[num_servers];
for (size_t i = 0; i < num_servers; i++) { for (size_t i = 0; i < num_servers; i++) {
servers[i].stub = Worker::NewStub(CreateChannel(workers[i], servers[i].stub =
InsecureCredentials())); Worker::NewStub(CreateChannel(workers[i], InsecureCredentials()));
ServerArgs args; ServerArgs args;
result_server_config = server_config; result_server_config = server_config;
result_server_config.set_host(workers[i]); result_server_config.set_host(workers[i]);
@ -181,8 +181,8 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor // where class contained in std::vector must have a copy constructor
auto* clients = new ClientData[num_clients]; auto* clients = new ClientData[num_clients];
for (size_t i = 0; i < num_clients; i++) { for (size_t i = 0; i < num_clients; i++) {
clients[i].stub = Worker::NewStub(CreateChannel(workers[i + num_servers], clients[i].stub = Worker::NewStub(
InsecureCredentials())); CreateChannel(workers[i + num_servers], InsecureCredentials()));
ClientArgs args; ClientArgs args;
result_client_config = client_config; result_client_config = client_config;
result_client_config.set_host(workers[i + num_servers]); result_client_config.set_host(workers[i + num_servers]);

@ -52,7 +52,6 @@
#include "test/cpp/qps/qpstest.grpc.pb.h" #include "test/cpp/qps/qpstest.grpc.pb.h"
#include "test/cpp/qps/server.h" #include "test/cpp/qps/server.h"
namespace grpc { namespace grpc {
namespace testing { namespace testing {
@ -98,8 +97,7 @@ class AsyncQpsServerTest : public Server {
} }
} }
~AsyncQpsServerTest() { ~AsyncQpsServerTest() {
auto deadline = std::chrono::system_clock::now() + auto deadline = std::chrono::system_clock::now() + std::chrono::seconds(10);
std::chrono::seconds(10);
server_->Shutdown(deadline); server_->Shutdown(deadline);
for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) { for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) {
(*ss)->set_shutdown(); (*ss)->set_shutdown();

@ -47,7 +47,6 @@
#include "test/cpp/qps/server.h" #include "test/cpp/qps/server.h"
#include "test/cpp/qps/timer.h" #include "test/cpp/qps/timer.h"
namespace grpc { namespace grpc {
namespace testing { namespace testing {
@ -86,8 +85,7 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service {
class SynchronousServer GRPC_FINAL : public grpc::testing::Server { class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
public: public:
SynchronousServer(const ServerConfig& config, int port) SynchronousServer(const ServerConfig& config, int port)
: impl_(MakeImpl(port)) { : impl_(MakeImpl(port)) {}
}
private: private:
std::unique_ptr<grpc::Server> MakeImpl(int port) { std::unique_ptr<grpc::Server> MakeImpl(int port) {

@ -45,8 +45,7 @@ const char kTestStringWithEmbeddedNull[] = "blah\0foo";
const size_t kTestStringWithEmbeddedNullLength = 8; const size_t kTestStringWithEmbeddedNullLength = 8;
const char kTestUnrelatedString[] = "foo"; const char kTestUnrelatedString[] = "foo";
class StringRefTest : public ::testing::Test { class StringRefTest : public ::testing::Test {};
};
TEST_F(StringRefTest, Empty) { TEST_F(StringRefTest, Empty) {
string_ref s; string_ref s;
@ -74,7 +73,8 @@ TEST_F(StringRefTest, FromString) {
} }
TEST_F(StringRefTest, CopyConstructor) { TEST_F(StringRefTest, CopyConstructor) {
string_ref s1(kTestString);; string_ref s1(kTestString);
;
string_ref s2(s1); string_ref s2(s1);
EXPECT_EQ(s1.length(), s2.length()); EXPECT_EQ(s1.length(), s2.length());
EXPECT_EQ(s1.data(), s2.data()); EXPECT_EQ(s1.data(), s2.data());
@ -89,7 +89,8 @@ TEST_F(StringRefTest, FromStringWithEmbeddedNull) {
} }
TEST_F(StringRefTest, Assignment) { TEST_F(StringRefTest, Assignment) {
string_ref s1(kTestString);; string_ref s1(kTestString);
;
string_ref s2; string_ref s2;
EXPECT_EQ(nullptr, s2.data()); EXPECT_EQ(nullptr, s2.data());
s2 = s1; s2 = s1;
@ -109,7 +110,7 @@ TEST_F(StringRefTest, Iterator) {
TEST_F(StringRefTest, ReverseIterator) { TEST_F(StringRefTest, ReverseIterator) {
string_ref s(kTestString); string_ref s(kTestString);
size_t i = strlen(kTestString); size_t i = strlen(kTestString);
for (auto rit = s.crbegin(); rit != s.crend(); ++rit) { for (auto rit = s.crbegin(); rit != s.crend(); ++rit) {
EXPECT_EQ(kTestString[--i], *rit); EXPECT_EQ(kTestString[--i], *rit);
} }
EXPECT_EQ(0U, i); EXPECT_EQ(0U, i);
@ -168,9 +169,9 @@ TEST_F(StringRefTest, Find) {
EXPECT_EQ(0U, s1.find(s1)); EXPECT_EQ(0U, s1.find(s1));
EXPECT_EQ(0U, s2.find(s2)); EXPECT_EQ(0U, s2.find(s2));
EXPECT_EQ(0U, s3.find(s3)); EXPECT_EQ(0U, s3.find(s3));
EXPECT_EQ(string_ref::npos,s1.find(s2) ); EXPECT_EQ(string_ref::npos, s1.find(s2));
EXPECT_EQ(string_ref::npos,s2.find(s1)); EXPECT_EQ(string_ref::npos, s2.find(s1));
EXPECT_EQ(string_ref::npos,s1.find(s3)); EXPECT_EQ(string_ref::npos, s1.find(s3));
EXPECT_EQ(0U, s3.find(s1)); EXPECT_EQ(0U, s3.find(s1));
EXPECT_EQ(5U, s3.find(s2)); EXPECT_EQ(5U, s3.find(s2));
EXPECT_EQ(string_ref::npos, s1.find('z')); EXPECT_EQ(string_ref::npos, s1.find('z'));
@ -212,4 +213,3 @@ int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }

@ -4,7 +4,7 @@
DIRS="src/core src/cpp test/core test/cpp include" DIRS="src/core src/cpp test/core test/cpp include"
# file matching patterns to check # file matching patterns to check
GLOB="*.h *.cpp" GLOB="*.h *.c *.cc"
# clang format command # clang format command
CLANG_FORMAT=clang-format-3.6 CLANG_FORMAT=clang-format-3.6

Loading…
Cancel
Save