Skip to content
Snippets Groups Projects
Commit b20111ca authored by Craig Tiller's avatar Craig Tiller Committed by Craig Tiller
Browse files

clang-format

parent 08453374
No related branches found
No related tags found
No related merge requests found
...@@ -361,7 +361,7 @@ typedef struct grpc_op { ...@@ -361,7 +361,7 @@ typedef struct grpc_op {
library). */ library). */
void grpc_init(void); void grpc_init(void);
/* Shut down the grpc library. /* Shut down the grpc library.
No memory is used by grpc after this call returns, nor are any instructions No memory is used by grpc after this call returns, nor are any instructions
executing within the grpc library. executing within the grpc library.
Prior to calling, all application owned grpc objects must have been Prior to calling, all application owned grpc objects must have been
...@@ -395,9 +395,9 @@ void grpc_event_finish(grpc_event *event); ...@@ -395,9 +395,9 @@ void grpc_event_finish(grpc_event *event);
/* Begin destruction of a completion queue. Once all possible events are /* Begin destruction of a completion queue. Once all possible events are
drained then grpc_completion_queue_next will start to produce drained then grpc_completion_queue_next will start to produce
GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call
grpc_completion_queue_destroy. grpc_completion_queue_destroy.
After calling this function applications should ensure that no After calling this function applications should ensure that no
NEW work is added to be published on this completion queue. */ NEW work is added to be published on this completion queue. */
void grpc_completion_queue_shutdown(grpc_completion_queue *cq); void grpc_completion_queue_shutdown(grpc_completion_queue *cq);
...@@ -422,14 +422,13 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel, ...@@ -422,14 +422,13 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel,
gpr_timespec deadline); gpr_timespec deadline);
/* Pre-register a method/host pair on a channel. */ /* Pre-register a method/host pair on a channel. */
void *grpc_channel_register_call(grpc_channel *channel, const char *method, void *grpc_channel_register_call(grpc_channel *channel, const char *method,
const char *host); const char *host);
/* Create a call given a handle returned from grpc_channel_register_call */ /* Create a call given a handle returned from grpc_channel_register_call */
grpc_call *grpc_channel_create_registered_call(grpc_channel *channel, grpc_call *grpc_channel_create_registered_call(
grpc_completion_queue *completion_queue, grpc_channel *channel, grpc_completion_queue *completion_queue,
void *registered_call_handle, void *registered_call_handle, gpr_timespec deadline);
gpr_timespec deadline);
/* Start a batch of operations defined in the array ops; when complete, post a /* Start a batch of operations defined in the array ops; when complete, post a
completion of type 'tag' to the completion queue bound to the call. completion of type 'tag' to the completion queue bound to the call.
...@@ -589,8 +588,7 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server, ...@@ -589,8 +588,7 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server,
grpc_call_error grpc_server_request_call( grpc_call_error grpc_server_request_call(
grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_server *server, grpc_call **call, grpc_call_details *details,
grpc_metadata_array *request_metadata, grpc_metadata_array *request_metadata,
grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_bound_to_call, void *tag_new);
void *tag_new);
/* Registers a method in the server. /* Registers a method in the server.
Methods to this (host, method) pair will not be reported by Methods to this (host, method) pair will not be reported by
...@@ -645,4 +643,4 @@ void grpc_server_destroy(grpc_server *server); ...@@ -645,4 +643,4 @@ void grpc_server_destroy(grpc_server *server);
} }
#endif #endif
#endif /* GRPC_GRPC_H */ #endif /* GRPC_GRPC_H */
...@@ -63,7 +63,8 @@ struct grpc_channel { ...@@ -63,7 +63,8 @@ struct grpc_channel {
}; };
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c)+1)) #define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c)+1))
#define CHANNEL_FROM_CHANNEL_STACK(channel_stack) (((grpc_channel *)(channel_stack)) - 1) #define CHANNEL_FROM_CHANNEL_STACK(channel_stack) \
(((grpc_channel *)(channel_stack)) - 1)
#define CHANNEL_FROM_TOP_ELEM(top_elem) \ #define CHANNEL_FROM_TOP_ELEM(top_elem) \
CHANNEL_FROM_CHANNEL_STACK(grpc_channel_stack_from_top_element(top_elem)) CHANNEL_FROM_CHANNEL_STACK(grpc_channel_stack_from_top_element(top_elem))
...@@ -75,7 +76,8 @@ grpc_channel *grpc_channel_create_from_filters( ...@@ -75,7 +76,8 @@ grpc_channel *grpc_channel_create_from_filters(
grpc_channel *channel = gpr_malloc(size); grpc_channel *channel = gpr_malloc(size);
GPR_ASSERT(grpc_is_initialized() && "call grpc_init()"); GPR_ASSERT(grpc_is_initialized() && "call grpc_init()");
channel->is_client = is_client; channel->is_client = is_client;
/* decremented by grpc_channel_destroy, and grpc_client_channel_closed if is_client */ /* decremented by grpc_channel_destroy, and grpc_client_channel_closed if
* is_client */
gpr_ref_init(&channel->refs, 1 + is_client); gpr_ref_init(&channel->refs, 1 + is_client);
channel->metadata_context = mdctx; channel->metadata_context = mdctx;
channel->grpc_status_string = grpc_mdstr_from_string(mdctx, "grpc-status"); channel->grpc_status_string = grpc_mdstr_from_string(mdctx, "grpc-status");
...@@ -92,8 +94,8 @@ grpc_channel *grpc_channel_create_from_filters( ...@@ -92,8 +94,8 @@ grpc_channel *grpc_channel_create_from_filters(
static void do_nothing(void *ignored, grpc_op_error error) {} static void do_nothing(void *ignored, grpc_op_error error) {}
static grpc_call *grpc_channel_create_call_internal( static grpc_call *grpc_channel_create_call_internal(
grpc_channel *channel, grpc_completion_queue *cq, grpc_channel *channel, grpc_completion_queue *cq, grpc_mdelem *path_mdelem,
grpc_mdelem *path_mdelem, grpc_mdelem *authority_mdelem, gpr_timespec deadline) { grpc_mdelem *authority_mdelem, gpr_timespec deadline) {
grpc_call *call; grpc_call *call;
grpc_call_op op; grpc_call_op op;
...@@ -134,8 +136,7 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel, ...@@ -134,8 +136,7 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel,
const char *method, const char *host, const char *method, const char *host,
gpr_timespec deadline) { gpr_timespec deadline) {
return grpc_channel_create_call_internal( return grpc_channel_create_call_internal(
channel, channel, cq,
cq,
grpc_mdelem_from_metadata_strings( grpc_mdelem_from_metadata_strings(
channel->metadata_context, grpc_mdstr_ref(channel->path_string), channel->metadata_context, grpc_mdstr_ref(channel->path_string),
grpc_mdstr_from_string(channel->metadata_context, method)), grpc_mdstr_from_string(channel->metadata_context, method)),
...@@ -152,15 +153,15 @@ grpc_call *grpc_channel_create_call_old(grpc_channel *channel, ...@@ -152,15 +153,15 @@ grpc_call *grpc_channel_create_call_old(grpc_channel *channel,
absolute_deadline); absolute_deadline);
} }
void *grpc_channel_register_call(grpc_channel *channel, const char *method, void *grpc_channel_register_call(grpc_channel *channel, const char *method,
const char *host) { const char *host) {
registered_call *rc = gpr_malloc(sizeof(registered_call)); registered_call *rc = gpr_malloc(sizeof(registered_call));
rc->path = grpc_mdelem_from_metadata_strings( rc->path = grpc_mdelem_from_metadata_strings(
channel->metadata_context, grpc_mdstr_ref(channel->path_string), channel->metadata_context, grpc_mdstr_ref(channel->path_string),
grpc_mdstr_from_string(channel->metadata_context, method)); grpc_mdstr_from_string(channel->metadata_context, method));
rc->authority = grpc_mdelem_from_metadata_strings( rc->authority = grpc_mdelem_from_metadata_strings(
channel->metadata_context, grpc_mdstr_ref(channel->authority_string), channel->metadata_context, grpc_mdstr_ref(channel->authority_string),
grpc_mdstr_from_string(channel->metadata_context, host)); grpc_mdstr_from_string(channel->metadata_context, host));
gpr_mu_lock(&channel->registered_call_mu); gpr_mu_lock(&channel->registered_call_mu);
rc->next = channel->registered_calls; rc->next = channel->registered_calls;
channel->registered_calls = rc; channel->registered_calls = rc;
...@@ -168,12 +169,13 @@ void *grpc_channel_register_call(grpc_channel *channel, const char *method, ...@@ -168,12 +169,13 @@ void *grpc_channel_register_call(grpc_channel *channel, const char *method,
return rc; return rc;
} }
grpc_call *grpc_channel_create_registered_call(grpc_channel *channel, grpc_call *grpc_channel_create_registered_call(
grpc_completion_queue *completion_queue, grpc_channel *channel, grpc_completion_queue *completion_queue,
void *registered_call_handle, void *registered_call_handle, gpr_timespec deadline) {
gpr_timespec deadline) {
registered_call *rc = registered_call_handle; registered_call *rc = registered_call_handle;
return grpc_channel_create_call_internal(channel, completion_queue, grpc_mdelem_ref(rc->path), grpc_mdelem_ref(rc->authority), deadline); return grpc_channel_create_call_internal(
channel, completion_queue, grpc_mdelem_ref(rc->path),
grpc_mdelem_ref(rc->authority), deadline);
} }
void grpc_channel_internal_ref(grpc_channel *channel) { void grpc_channel_internal_ref(grpc_channel *channel) {
......
...@@ -194,7 +194,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { ...@@ -194,7 +194,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) {
static void test_invoke_simple_request(grpc_end2end_test_config config) { static void test_invoke_simple_request(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL); grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
void *rc = grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234"); void *rc =
grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234");
simple_request_body(f, rc); simple_request_body(f, rc);
end_test(&f); end_test(&f);
...@@ -204,7 +205,8 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { ...@@ -204,7 +205,8 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) {
static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { static void test_invoke_10_simple_requests(grpc_end2end_test_config config) {
int i; int i;
grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL); grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL);
void *rc = grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234"); void *rc =
grpc_channel_register_call(f.client, "/foo", "foo.test.google.fr:1234");
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
simple_request_body(f, rc); simple_request_body(f, rc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment