From a0ed373d3cb6d93b55ebe753b276c2ddf1fc7b65 Mon Sep 17 00:00:00 2001 From: Garrett Casto Date: Mon, 7 Nov 2016 20:36:31 -0800 Subject: Change interface --- .../cronet/client/secure/cronet_channel_create.c | 2 +- .../transport/cronet/transport/cronet_api_dummy.c | 29 +++--- .../transport/cronet/transport/cronet_transport.c | 116 ++++++++++----------- src/objective-c/GRPCClient/GRPCCall+Cronet.h | 6 +- src/objective-c/GRPCClient/GRPCCall+Cronet.m | 6 +- src/objective-c/GRPCClient/private/GRPCChannel.m | 4 +- 6 files changed, 81 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c index df1acddcc0..477cf07f45 100644 --- a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c +++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.c @@ -60,7 +60,7 @@ GRPCAPI grpc_channel *grpc_cronet_secure_channel_create( ct->host = gpr_malloc(strlen(target) + 1); strcpy(ct->host, target); gpr_log(GPR_DEBUG, - "grpc_create_cronet_transport: cronet_engine = %p, target=%s", engine, + "grpc_create_cronet_transport: stream_engine = %p, target=%s", engine, ct->host); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; diff --git a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c index 687026c9fd..1c4253f43f 100644 --- a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c +++ b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c @@ -38,48 +38,47 @@ library, so we can build it in all environments */ #include -#include "third_party/objective_c/Cronet/cronet_c_for_grpc.h" +#include "third_party/Cronet/bidirectional_stream_c.h" #ifdef GRPC_COMPILE_WITH_CRONET /* link with the real CRONET library in the build system */ #else /* Dummy implementation of cronet API just to test for build-ability */ -cronet_bidirectional_stream* cronet_bidirectional_stream_create( - cronet_engine* engine, void* annotation, - cronet_bidirectional_stream_callback* callback) { +bidirectional_stream* bidirectional_stream_create( + stream_engine* engine, void* annotation, + bidirectional_stream_callback* callback) { GPR_ASSERT(0); return NULL; } -int cronet_bidirectional_stream_destroy(cronet_bidirectional_stream* stream) { +int bidirectional_stream_destroy(bidirectional_stream* stream) { GPR_ASSERT(0); return 0; } -int cronet_bidirectional_stream_start( - cronet_bidirectional_stream* stream, const char* url, int priority, - const char* method, const cronet_bidirectional_stream_header_array* headers, +int bidirectional_stream_start( + bidirectional_stream* stream, const char* url, int priority, + const char* method, const bidirectional_stream_header_array* headers, bool end_of_stream) { GPR_ASSERT(0); return 0; } -int cronet_bidirectional_stream_read(cronet_bidirectional_stream* stream, - char* buffer, int capacity) { +int bidirectional_stream_read(bidirectional_stream* stream, + char* buffer, int capacity) { GPR_ASSERT(0); return 0; } -int cronet_bidirectional_stream_write(cronet_bidirectional_stream* stream, - const char* buffer, int count, - bool end_of_stream) { +int bidirectional_stream_write(bidirectional_stream* stream, + const char* buffer, int count, + bool end_of_stream) { GPR_ASSERT(0); return 0; } -int cronet_bidirectional_stream_cancel(cronet_bidirectional_stream* stream) { +void bidirectional_stream_cancel(bidirectional_stream* stream) { GPR_ASSERT(0); - return 0; } #endif /* GRPC_COMPILE_WITH_CRONET */ diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index a4c110101e..28c4fbe9fe 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -49,7 +49,7 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/transport_impl.h" -#include "third_party/objective_c/Cronet/cronet_c_for_grpc.h" +#include "third_party/Cronet/bidirectional_stream_c.h" #define GRPC_HEADER_SIZE_IN_BYTES 5 @@ -86,19 +86,19 @@ enum e_op_id { /* Cronet callbacks. See cronet_c_for_grpc.h for documentation for each. */ -static void on_request_headers_sent(cronet_bidirectional_stream *); +static void on_request_headers_sent(bidirectional_stream *); static void on_response_headers_received( - cronet_bidirectional_stream *, - const cronet_bidirectional_stream_header_array *, const char *); -static void on_write_completed(cronet_bidirectional_stream *, const char *); -static void on_read_completed(cronet_bidirectional_stream *, char *, int); + bidirectional_stream *, + const bidirectional_stream_header_array *, const char *); +static void on_write_completed(bidirectional_stream *, const char *); +static void on_read_completed(bidirectional_stream *, char *, int); static void on_response_trailers_received( - cronet_bidirectional_stream *, - const cronet_bidirectional_stream_header_array *); -static void on_succeeded(cronet_bidirectional_stream *); -static void on_failed(cronet_bidirectional_stream *, int); -static void on_canceled(cronet_bidirectional_stream *); -static cronet_bidirectional_stream_callback cronet_callbacks = { + bidirectional_stream *, + const bidirectional_stream_header_array *); +static void on_succeeded(bidirectional_stream *); +static void on_failed(bidirectional_stream *, int); +static void on_canceled(bidirectional_stream *); +static bidirectional_stream_callback cronet_callbacks = { on_request_headers_sent, on_response_headers_received, on_read_completed, @@ -111,7 +111,7 @@ static cronet_bidirectional_stream_callback cronet_callbacks = { /* Cronet transport object */ struct grpc_cronet_transport { grpc_transport base; /* must be first element in this structure */ - cronet_engine *engine; + stream_engine *engine; char *host; }; typedef struct grpc_cronet_transport grpc_cronet_transport; @@ -173,8 +173,8 @@ struct stream_obj { grpc_transport_stream_op *curr_op; grpc_cronet_transport curr_ct; grpc_stream *curr_gs; - cronet_bidirectional_stream *cbs; - cronet_bidirectional_stream_header_array header_array; + bidirectional_stream *cbs; + bidirectional_stream_header_array header_array; /* Stream level state. Some state will be tracked both at stream and stream_op * level */ @@ -335,11 +335,11 @@ static void execute_from_storage(stream_obj *s) { /* Cronet callback */ -static void on_failed(cronet_bidirectional_stream *stream, int net_error) { +static void on_failed(bidirectional_stream *stream, int net_error) { CRONET_LOG(GPR_DEBUG, "on_failed(%p, %d)", stream, net_error); stream_obj *s = (stream_obj *)stream->annotation; gpr_mu_lock(&s->mu); - cronet_bidirectional_stream_destroy(s->cbs); + bidirectional_stream_destroy(s->cbs); s->state.state_callback_received[OP_FAILED] = true; s->cbs = NULL; if (s->header_array.headers) { @@ -358,11 +358,11 @@ static void on_failed(cronet_bidirectional_stream *stream, int net_error) { /* Cronet callback */ -static void on_canceled(cronet_bidirectional_stream *stream) { +static void on_canceled(bidirectional_stream *stream) { CRONET_LOG(GPR_DEBUG, "on_canceled(%p)", stream); stream_obj *s = (stream_obj *)stream->annotation; gpr_mu_lock(&s->mu); - cronet_bidirectional_stream_destroy(s->cbs); + bidirectional_stream_destroy(s->cbs); s->state.state_callback_received[OP_CANCELED] = true; s->cbs = NULL; if (s->header_array.headers) { @@ -381,11 +381,11 @@ static void on_canceled(cronet_bidirectional_stream *stream) { /* Cronet callback */ -static void on_succeeded(cronet_bidirectional_stream *stream) { +static void on_succeeded(bidirectional_stream *stream) { CRONET_LOG(GPR_DEBUG, "on_succeeded(%p)", stream); stream_obj *s = (stream_obj *)stream->annotation; gpr_mu_lock(&s->mu); - cronet_bidirectional_stream_destroy(s->cbs); + bidirectional_stream_destroy(s->cbs); s->state.state_callback_received[OP_SUCCEEDED] = true; s->cbs = NULL; free_read_buffer(s); @@ -396,7 +396,7 @@ static void on_succeeded(cronet_bidirectional_stream *stream) { /* Cronet callback */ -static void on_request_headers_sent(cronet_bidirectional_stream *stream) { +static void on_request_headers_sent(bidirectional_stream *stream) { CRONET_LOG(GPR_DEBUG, "W: on_request_headers_sent(%p)", stream); stream_obj *s = (stream_obj *)stream->annotation; gpr_mu_lock(&s->mu); @@ -415,8 +415,8 @@ static void on_request_headers_sent(cronet_bidirectional_stream *stream) { Cronet callback */ static void on_response_headers_received( - cronet_bidirectional_stream *stream, - const cronet_bidirectional_stream_header_array *headers, + bidirectional_stream *stream, + const bidirectional_stream_header_array *headers, const char *negotiated_protocol) { CRONET_LOG(GPR_DEBUG, "R: on_response_headers_received(%p, %p, %s)", stream, headers, negotiated_protocol); @@ -440,7 +440,7 @@ static void on_response_headers_received( /* Cronet callback */ -static void on_write_completed(cronet_bidirectional_stream *stream, +static void on_write_completed(bidirectional_stream *stream, const char *data) { stream_obj *s = (stream_obj *)stream->annotation; CRONET_LOG(GPR_DEBUG, "W: on_write_completed(%p, %s)", stream, data); @@ -457,7 +457,7 @@ static void on_write_completed(cronet_bidirectional_stream *stream, /* Cronet callback */ -static void on_read_completed(cronet_bidirectional_stream *stream, char *data, +static void on_read_completed(bidirectional_stream *stream, char *data, int count) { stream_obj *s = (stream_obj *)stream->annotation; CRONET_LOG(GPR_DEBUG, "R: on_read_completed(%p, %p, %d)", stream, data, @@ -468,9 +468,9 @@ static void on_read_completed(cronet_bidirectional_stream *stream, char *data, s->state.rs.received_bytes += count; s->state.rs.remaining_bytes -= count; if (s->state.rs.remaining_bytes > 0) { - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_read(%p)", s->cbs); + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_read(%p)", s->cbs); s->state.state_op_done[OP_READ_REQ_MADE] = true; - cronet_bidirectional_stream_read( + bidirectional_stream_read( s->cbs, s->state.rs.read_buffer + s->state.rs.received_bytes, s->state.rs.remaining_bytes); gpr_mu_unlock(&s->mu); @@ -489,8 +489,8 @@ static void on_read_completed(cronet_bidirectional_stream *stream, char *data, Cronet callback */ static void on_response_trailers_received( - cronet_bidirectional_stream *stream, - const cronet_bidirectional_stream_header_array *trailers) { + bidirectional_stream *stream, + const bidirectional_stream_header_array *trailers) { CRONET_LOG(GPR_DEBUG, "R: on_response_trailers_received(%p,%p)", stream, trailers); stream_obj *s = (stream_obj *)stream->annotation; @@ -543,7 +543,7 @@ static void create_grpc_frame(grpc_slice_buffer *write_slice_buffer, */ static void convert_metadata_to_cronet_headers( grpc_linked_mdelem *head, const char *host, char **pp_url, - cronet_bidirectional_stream_header **pp_headers, size_t *p_num_headers, + bidirectional_stream_header **pp_headers, size_t *p_num_headers, const char **method) { grpc_linked_mdelem *curr = head; /* Walk the linked list and get number of header fields */ @@ -554,9 +554,9 @@ static void convert_metadata_to_cronet_headers( } /* Allocate enough memory. It is freed in the on_request_headers_sent callback */ - cronet_bidirectional_stream_header *headers = - (cronet_bidirectional_stream_header *)gpr_malloc( - sizeof(cronet_bidirectional_stream_header) * num_headers_available); + bidirectional_stream_header *headers = + (bidirectional_stream_header *)gpr_malloc( + sizeof(bidirectional_stream_header) * num_headers_available); *pp_headers = headers; /* Walk the linked list again, this time copying the header fields. @@ -788,9 +788,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, /* Start new cronet stream. It is destroyed in on_succeeded, on_canceled, * on_failed */ GPR_ASSERT(s->cbs == NULL); - s->cbs = cronet_bidirectional_stream_create(s->curr_ct.engine, s->curr_gs, - &cronet_callbacks); - CRONET_LOG(GPR_DEBUG, "%p = cronet_bidirectional_stream_create()", s->cbs); + s->cbs = bidirectional_stream_create(s->curr_ct.engine, s->curr_gs, + &cronet_callbacks); + CRONET_LOG(GPR_DEBUG, "%p = bidirectional_stream_create()", s->cbs); char *url = NULL; const char *method = "POST"; s->header_array.headers = NULL; @@ -798,10 +798,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_op->send_initial_metadata->list.head, s->curr_ct.host, &url, &s->header_array.headers, &s->header_array.count, &method); s->header_array.capacity = s->header_array.count; - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_start(%p, %s)", s->cbs, + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url); - cronet_bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, - false); + bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, + false); stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true; result = ACTION_TAKEN_WITH_CALLBACK; } else if (stream_op->recv_initial_metadata && @@ -849,11 +849,11 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, size_t write_buffer_size; create_grpc_frame(&write_slice_buffer, &stream_state->ws.write_buffer, &write_buffer_size); - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_write (%p, %p)", + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, %p)", s->cbs, stream_state->ws.write_buffer); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; - cronet_bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer, - (int)write_buffer_size, false); + bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer, + (int)write_buffer_size, false); result = ACTION_TAKEN_WITH_CALLBACK; } else { result = NO_ACTION_POSSIBLE; @@ -893,11 +893,11 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, GPR_ASSERT(stream_state->rs.read_buffer); stream_state->rs.remaining_bytes = stream_state->rs.length_field; stream_state->rs.received_bytes = 0; - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_read(%p)", s->cbs); + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_read(%p)", s->cbs); stream_state->state_op_done[OP_READ_REQ_MADE] = true; /* Indicates that at least one read request has been made */ - cronet_bidirectional_stream_read(s->cbs, stream_state->rs.read_buffer, - stream_state->rs.remaining_bytes); + bidirectional_stream_read(s->cbs, stream_state->rs.read_buffer, + stream_state->rs.remaining_bytes); result = ACTION_TAKEN_WITH_CALLBACK; } else { stream_state->rs.remaining_bytes = 0; @@ -918,11 +918,11 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->rs.read_buffer = stream_state->rs.grpc_header_bytes; stream_state->rs.remaining_bytes = GRPC_HEADER_SIZE_IN_BYTES; stream_state->rs.received_bytes = 0; - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_read(%p)", s->cbs); + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_read(%p)", s->cbs); stream_state->state_op_done[OP_READ_REQ_MADE] = true; /* Indicates that at least one read request has been made */ - cronet_bidirectional_stream_read(s->cbs, stream_state->rs.read_buffer, - stream_state->rs.remaining_bytes); + bidirectional_stream_read(s->cbs, stream_state->rs.read_buffer, + stream_state->rs.remaining_bytes); result = ACTION_TAKEN_WITH_CALLBACK; } else { result = NO_ACTION_POSSIBLE; @@ -972,10 +972,10 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, result = NO_ACTION_POSSIBLE; CRONET_LOG(GPR_DEBUG, "Stream is either cancelled or failed."); } else { - CRONET_LOG(GPR_DEBUG, "cronet_bidirectional_stream_write (%p, 0)", + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", s->cbs); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; - cronet_bidirectional_stream_write(s->cbs, "", 0, true); + bidirectional_stream_write(s->cbs, "", 0, true); result = ACTION_TAKEN_WITH_CALLBACK; } stream_state->state_op_done[OP_SEND_TRAILING_METADATA] = true; @@ -983,9 +983,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, op_can_be_run(stream_op, stream_state, &oas->state, OP_CANCEL_ERROR)) { CRONET_LOG(GPR_DEBUG, "running: %p OP_CANCEL_ERROR", oas); - CRONET_LOG(GPR_DEBUG, "W: cronet_bidirectional_stream_cancel(%p)", s->cbs); + CRONET_LOG(GPR_DEBUG, "W: bidirectional_stream_cancel(%p)", s->cbs); if (s->cbs) { - cronet_bidirectional_stream_cancel(s->cbs); + bidirectional_stream_cancel(s->cbs); } stream_state->state_op_done[OP_CANCEL_ERROR] = true; result = ACTION_TAKEN_WITH_CALLBACK; @@ -1064,9 +1064,9 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, header_has_authority(op->send_initial_metadata->list.head)) { /* Cronet does not support :authority header field. We cancel the call when this field is present in metadata */ - cronet_bidirectional_stream_header_array header_array; - cronet_bidirectional_stream_header *header; - cronet_bidirectional_stream cbs; + bidirectional_stream_header_array header_array; + bidirectional_stream_header *header; + bidirectional_stream cbs; CRONET_LOG(GPR_DEBUG, ":authority header is provided but not supported;" " cancel operations"); @@ -1074,8 +1074,8 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, header_array.count = 1; header_array.capacity = 1; header_array.headers = - gpr_malloc(sizeof(cronet_bidirectional_stream_header)); - header = (cronet_bidirectional_stream_header *)header_array.headers; + gpr_malloc(sizeof(bidirectional_stream_header)); + header = (bidirectional_stream_header *)header_array.headers; header->key = "grpc-status"; header->value = "1"; /* Return status GRPC_STATUS_CANCELLED */ cbs.annotation = (void *)s; diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.h b/src/objective-c/GRPCClient/GRPCCall+Cronet.h index 2d8f7ac8fb..b9d286c929 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.h +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.h @@ -43,13 +43,13 @@ /** * This method should be called before issuing the first RPC. It should be * called only once. Create an instance of Cronet engine in your app elsewhere - * and pass the instance pointer in the cronet_engine parameter. Once set, + * and pass the instance pointer in the stream_engine parameter. Once set, * all subsequent RPCs will use Cronet transport. The method is not thread * safe. */ -+(void)useCronetWithEngine:(cronet_engine *)engine; ++(void)useCronetWithEngine:(stream_engine *)engine; -+(cronet_engine *)cronetEngine; ++(stream_engine *)cronetEngine; +(BOOL)isUsingCronet; diff --git a/src/objective-c/GRPCClient/GRPCCall+Cronet.m b/src/objective-c/GRPCClient/GRPCCall+Cronet.m index 76ca1a2537..0e3598fb87 100644 --- a/src/objective-c/GRPCClient/GRPCCall+Cronet.m +++ b/src/objective-c/GRPCClient/GRPCCall+Cronet.m @@ -35,16 +35,16 @@ #ifdef GRPC_COMPILE_WITH_CRONET static BOOL useCronet = NO; -static cronet_engine *globalCronetEngine; +static stream_engine *globalCronetEngine; @implementation GRPCCall (Cronet) -+ (void)useCronetWithEngine:(cronet_engine *)engine { ++ (void)useCronetWithEngine:(stream_engine *)engine { useCronet = YES; globalCronetEngine = engine; } -+ (cronet_engine *)cronetEngine { ++ (stream_engine *)cronetEngine { return globalCronetEngine; } diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index e49aceefe1..2397c929f7 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -108,7 +108,7 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) { #ifdef GRPC_COMPILE_WITH_CRONET - (instancetype)initWithHost:(NSString *)host - cronetEngine:(cronet_engine *)cronetEngine + cronetEngine:(stream_engine *)cronetEngine channelArgs:(NSDictionary *)channelArgs { if (!host) { [NSException raise:NSInvalidArgumentException format:@"host argument missing"]; @@ -163,7 +163,7 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) { #ifdef GRPC_COMPILE_WITH_CRONET + (GRPCChannel *)secureCronetChannelWithHost:(NSString *)host channelArgs:(NSDictionary *)channelArgs { - cronet_engine *engine = [GRPCCall cronetEngine]; + stream_engine *engine = [GRPCCall cronetEngine]; if (!engine) { [NSException raise:NSInvalidArgumentException format:@"cronet_engine is NULL. Set it first."]; -- cgit v1.2.3 From 0c2fb6a2a428b76c931f3795ce53e0794dbfdccd Mon Sep 17 00:00:00 2001 From: Garrett Casto Date: Tue, 22 Nov 2016 11:14:39 -0800 Subject: Fix CoreCronetEnd2EndTests --- src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index 4a92cc8e0d..40a18a5aa5 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -94,7 +94,7 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx, static void cronet_init_client_secure_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args, - cronet_engine *cronetEngine) { + stream_engine *cronetEngine) { fullstack_secure_fixture_data *ffd = f->fixture_data; f->client = grpc_cronet_secure_channel_create(cronetEngine, ffd->localaddr, client_args, NULL); @@ -124,7 +124,7 @@ static void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) { static void cronet_init_client_simple_ssl_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - cronet_engine *cronetEngine = [Cronet getGlobalEngine]; + stream_engine *cronetEngine = [Cronet getGlobalEngine]; grpc_channel_args *new_client_args = grpc_channel_args_copy(client_args); cronet_init_client_secure_fullstack(f, new_client_args, cronetEngine); -- cgit v1.2.3 From 33fdafbf18bc3f80bfddf998facefc6c9dd9f456 Mon Sep 17 00:00:00 2001 From: Garrett Casto Date: Tue, 29 Nov 2016 11:32:03 -0800 Subject: clang-format --- .../transport/cronet/transport/cronet_transport.c | 26 +++++++++------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 28c4fbe9fe..084532ea83 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -88,13 +88,12 @@ enum e_op_id { static void on_request_headers_sent(bidirectional_stream *); static void on_response_headers_received( - bidirectional_stream *, - const bidirectional_stream_header_array *, const char *); + bidirectional_stream *, const bidirectional_stream_header_array *, + const char *); static void on_write_completed(bidirectional_stream *, const char *); static void on_read_completed(bidirectional_stream *, char *, int); static void on_response_trailers_received( - bidirectional_stream *, - const bidirectional_stream_header_array *); + bidirectional_stream *, const bidirectional_stream_header_array *); static void on_succeeded(bidirectional_stream *); static void on_failed(bidirectional_stream *, int); static void on_canceled(bidirectional_stream *); @@ -440,8 +439,7 @@ static void on_response_headers_received( /* Cronet callback */ -static void on_write_completed(bidirectional_stream *stream, - const char *data) { +static void on_write_completed(bidirectional_stream *stream, const char *data) { stream_obj *s = (stream_obj *)stream->annotation; CRONET_LOG(GPR_DEBUG, "W: on_write_completed(%p, %s)", stream, data); gpr_mu_lock(&s->mu); @@ -798,10 +796,8 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_op->send_initial_metadata->list.head, s->curr_ct.host, &url, &s->header_array.headers, &s->header_array.count, &method); s->header_array.capacity = s->header_array.count; - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, - url); - bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, - false); + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url); + bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false); stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true; result = ACTION_TAKEN_WITH_CALLBACK; } else if (stream_op->recv_initial_metadata && @@ -849,8 +845,8 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, size_t write_buffer_size; create_grpc_frame(&write_slice_buffer, &stream_state->ws.write_buffer, &write_buffer_size); - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, %p)", - s->cbs, stream_state->ws.write_buffer); + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, %p)", s->cbs, + stream_state->ws.write_buffer); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer, (int)write_buffer_size, false); @@ -972,8 +968,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, result = NO_ACTION_POSSIBLE; CRONET_LOG(GPR_DEBUG, "Stream is either cancelled or failed."); } else { - CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", - s->cbs); + CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, 0)", s->cbs); stream_state->state_callback_received[OP_SEND_MESSAGE] = false; bidirectional_stream_write(s->cbs, "", 0, true); result = ACTION_TAKEN_WITH_CALLBACK; @@ -1073,8 +1068,7 @@ static void perform_stream_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, /* Notify application that operation is cancelled by forging trailers */ header_array.count = 1; header_array.capacity = 1; - header_array.headers = - gpr_malloc(sizeof(bidirectional_stream_header)); + header_array.headers = gpr_malloc(sizeof(bidirectional_stream_header)); header = (bidirectional_stream_header *)header_array.headers; header->key = "grpc-status"; header->value = "1"; /* Return status GRPC_STATUS_CANCELLED */ -- cgit v1.2.3 From 72f8e14a8068140fcda53b537253792c4907de5a Mon Sep 17 00:00:00 2001 From: Garrett Casto Date: Wed, 30 Nov 2016 13:12:39 -0800 Subject: More clang-format --- .../ext/transport/cronet/transport/cronet_api_dummy.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c index 1c4253f43f..74327a4214 100644 --- a/src/core/ext/transport/cronet/transport/cronet_api_dummy.c +++ b/src/core/ext/transport/cronet/transport/cronet_api_dummy.c @@ -56,23 +56,22 @@ int bidirectional_stream_destroy(bidirectional_stream* stream) { return 0; } -int bidirectional_stream_start( - bidirectional_stream* stream, const char* url, int priority, - const char* method, const bidirectional_stream_header_array* headers, - bool end_of_stream) { +int bidirectional_stream_start(bidirectional_stream* stream, const char* url, + int priority, const char* method, + const bidirectional_stream_header_array* headers, + bool end_of_stream) { GPR_ASSERT(0); return 0; } -int bidirectional_stream_read(bidirectional_stream* stream, - char* buffer, int capacity) { +int bidirectional_stream_read(bidirectional_stream* stream, char* buffer, + int capacity) { GPR_ASSERT(0); return 0; } -int bidirectional_stream_write(bidirectional_stream* stream, - const char* buffer, int count, - bool end_of_stream) { +int bidirectional_stream_write(bidirectional_stream* stream, const char* buffer, + int count, bool end_of_stream) { GPR_ASSERT(0); return 0; } -- cgit v1.2.3 From 871626ff160b6431c3b20ba906d80f4aa7edc0c1 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 9 Jan 2017 18:06:49 -0800 Subject: clang-format --- src/core/ext/transport/cronet/transport/cronet_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 099f50b406..06c7e41dad 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -1001,7 +1001,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, stream_state->rs.length_field_received = false; CRONET_LOG(GPR_DEBUG, "bidirectional_stream_read(%p)", s->cbs); bidirectional_stream_read(s->cbs, stream_state->rs.read_buffer, - stream_state->rs.remaining_bytes); + stream_state->rs.remaining_bytes); result = ACTION_TAKEN_NO_CALLBACK; } } else if (stream_op->recv_trailing_metadata && -- cgit v1.2.3