aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-04-10 23:27:11 +0000
committerGravatar Craig Tiller <ctiller@google.com>2015-04-16 09:29:17 -0700
commitb20111caea9e7094a79fcd55c85eb74a59dc8da4 (patch)
treec14874bbc61fea3f281e45fad8b2f6fcff038584
parent08453374b2c58813201739bf4e69383235804a29 (diff)
clang-format
-rw-r--r--include/grpc/grpc.h22
-rw-r--r--src/core/surface/channel.c34
-rw-r--r--test/core/end2end/tests/registered_call.c6
3 files changed, 32 insertions, 30 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index 89c822504c..ffab65ff59 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -361,7 +361,7 @@ typedef struct grpc_op {
library). */
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
executing within the grpc library.
Prior to calling, all application owned grpc objects must have been
@@ -395,9 +395,9 @@ void grpc_event_finish(grpc_event *event);
/* Begin destruction of a completion queue. Once all possible events are
drained then grpc_completion_queue_next will start to produce
- GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call
- grpc_completion_queue_destroy.
-
+ GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call
+ grpc_completion_queue_destroy.
+
After calling this function applications should ensure that no
NEW work is added to be published on this completion queue. */
void grpc_completion_queue_shutdown(grpc_completion_queue *cq);
@@ -422,14 +422,13 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel,
gpr_timespec deadline);
/* 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);
/* Create a call given a handle returned from grpc_channel_register_call */
-grpc_call *grpc_channel_create_registered_call(grpc_channel *channel,
- grpc_completion_queue *completion_queue,
- void *registered_call_handle,
- gpr_timespec deadline);
+grpc_call *grpc_channel_create_registered_call(
+ grpc_channel *channel, grpc_completion_queue *completion_queue,
+ void *registered_call_handle, gpr_timespec deadline);
/* 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.
@@ -589,8 +588,7 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server,
grpc_call_error grpc_server_request_call(
grpc_server *server, grpc_call **call, grpc_call_details *details,
grpc_metadata_array *request_metadata,
- grpc_completion_queue *cq_bound_to_call,
- void *tag_new);
+ grpc_completion_queue *cq_bound_to_call, void *tag_new);
/* Registers a method in the server.
Methods to this (host, method) pair will not be reported by
@@ -645,4 +643,4 @@ void grpc_server_destroy(grpc_server *server);
}
#endif
-#endif /* GRPC_GRPC_H */
+#endif /* GRPC_GRPC_H */
diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c
index adc339d479..d3962a00c4 100644
--- a/src/core/surface/channel.c
+++ b/src/core/surface/channel.c
@@ -63,7 +63,8 @@ struct grpc_channel {
};
#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) \
CHANNEL_FROM_CHANNEL_STACK(grpc_channel_stack_from_top_element(top_elem))
@@ -75,7 +76,8 @@ grpc_channel *grpc_channel_create_from_filters(
grpc_channel *channel = gpr_malloc(size);
GPR_ASSERT(grpc_is_initialized() && "call grpc_init()");
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);
channel->metadata_context = mdctx;
channel->grpc_status_string = grpc_mdstr_from_string(mdctx, "grpc-status");
@@ -92,8 +94,8 @@ grpc_channel *grpc_channel_create_from_filters(
static void do_nothing(void *ignored, grpc_op_error error) {}
static grpc_call *grpc_channel_create_call_internal(
- grpc_channel *channel, grpc_completion_queue *cq,
- grpc_mdelem *path_mdelem, grpc_mdelem *authority_mdelem, gpr_timespec deadline) {
+ grpc_channel *channel, grpc_completion_queue *cq, grpc_mdelem *path_mdelem,
+ grpc_mdelem *authority_mdelem, gpr_timespec deadline) {
grpc_call *call;
grpc_call_op op;
@@ -134,8 +136,7 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel,
const char *method, const char *host,
gpr_timespec deadline) {
return grpc_channel_create_call_internal(
- channel,
- cq,
+ channel, cq,
grpc_mdelem_from_metadata_strings(
channel->metadata_context, grpc_mdstr_ref(channel->path_string),
grpc_mdstr_from_string(channel->metadata_context, method)),
@@ -152,15 +153,15 @@ grpc_call *grpc_channel_create_call_old(grpc_channel *channel,
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) {
registered_call *rc = gpr_malloc(sizeof(registered_call));
rc->path = grpc_mdelem_from_metadata_strings(
- channel->metadata_context, grpc_mdstr_ref(channel->path_string),
- grpc_mdstr_from_string(channel->metadata_context, method));
+ channel->metadata_context, grpc_mdstr_ref(channel->path_string),
+ grpc_mdstr_from_string(channel->metadata_context, method));
rc->authority = grpc_mdelem_from_metadata_strings(
- channel->metadata_context, grpc_mdstr_ref(channel->authority_string),
- grpc_mdstr_from_string(channel->metadata_context, host));
+ channel->metadata_context, grpc_mdstr_ref(channel->authority_string),
+ grpc_mdstr_from_string(channel->metadata_context, host));
gpr_mu_lock(&channel->registered_call_mu);
rc->next = channel->registered_calls;
channel->registered_calls = rc;
@@ -168,12 +169,13 @@ void *grpc_channel_register_call(grpc_channel *channel, const char *method,
return rc;
}
-grpc_call *grpc_channel_create_registered_call(grpc_channel *channel,
- grpc_completion_queue *completion_queue,
- void *registered_call_handle,
- gpr_timespec deadline) {
+grpc_call *grpc_channel_create_registered_call(
+ grpc_channel *channel, grpc_completion_queue *completion_queue,
+ void *registered_call_handle, gpr_timespec deadline) {
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) {
diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c
index 2671eebfbd..05b7a1dad0 100644
--- a/test/core/end2end/tests/registered_call.c
+++ b/test/core/end2end/tests/registered_call.c
@@ -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) {
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);
end_test(&f);
@@ -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) {
int i;
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++) {
simple_request_body(f, rc);