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

clang-format

parent 88e3e7ad
No related branches found
No related tags found
No related merge requests found
...@@ -97,7 +97,7 @@ static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx, ...@@ -97,7 +97,7 @@ static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx,
// Set args fields to NULL, saving the endpoint and read buffer for // Set args fields to NULL, saving the endpoint and read buffer for
// later destruction. // later destruction.
static void cleanup_args_for_failure_locked( static void cleanup_args_for_failure_locked(
grpc_exec_ctx *exec_ctx, http_connect_handshaker* handshaker) { grpc_exec_ctx* exec_ctx, http_connect_handshaker* handshaker) {
handshaker->endpoint_to_destroy = handshaker->args->endpoint; handshaker->endpoint_to_destroy = handshaker->args->endpoint;
handshaker->args->endpoint = NULL; handshaker->args->endpoint = NULL;
handshaker->read_buffer_to_destroy = handshaker->args->read_buffer; handshaker->read_buffer_to_destroy = handshaker->args->read_buffer;
......
...@@ -137,8 +137,8 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds, ...@@ -137,8 +137,8 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
grpc_channel_security_connector *security_connector; grpc_channel_security_connector *security_connector;
grpc_channel_args *new_args_from_connector; grpc_channel_args *new_args_from_connector;
if (grpc_channel_credentials_create_security_connector( if (grpc_channel_credentials_create_security_connector(
&exec_ctx, creds, target, args, &security_connector, &new_args_from_connector) != &exec_ctx, creds, target, args, &security_connector,
GRPC_SECURITY_OK) { &new_args_from_connector) != GRPC_SECURITY_OK) {
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
return grpc_lame_client_channel_create( return grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL, "Failed to create security connector."); target, GRPC_STATUS_INTERNAL, "Failed to create security connector.");
......
...@@ -67,8 +67,8 @@ static void server_security_handshaker_factory_destroy( ...@@ -67,8 +67,8 @@ static void server_security_handshaker_factory_destroy(
grpc_exec_ctx *exec_ctx, grpc_chttp2_server_handshaker_factory *hf) { grpc_exec_ctx *exec_ctx, grpc_chttp2_server_handshaker_factory *hf) {
server_security_handshaker_factory *handshaker_factory = server_security_handshaker_factory *handshaker_factory =
(server_security_handshaker_factory *)hf; (server_security_handshaker_factory *)hf;
GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &handshaker_factory->security_connector->base, GRPC_SECURITY_CONNECTOR_UNREF(
"server"); exec_ctx, &handshaker_factory->security_connector->base, "server");
gpr_free(hf); gpr_free(hf);
} }
......
...@@ -429,8 +429,8 @@ static void on_response_headers_received( ...@@ -429,8 +429,8 @@ static void on_response_headers_received(
for (size_t i = 0; i < headers->count; i++) { for (size_t i = 0; i < headers->count; i++) {
grpc_chttp2_incoming_metadata_buffer_add( grpc_chttp2_incoming_metadata_buffer_add(
&s->state.rs.initial_metadata, &s->state.rs.initial_metadata,
grpc_mdelem_from_metadata_strings(&exec_ctx, grpc_mdelem_from_metadata_strings(
grpc_mdstr_from_string(headers->headers[i].key), &exec_ctx, grpc_mdstr_from_string(headers->headers[i].key),
grpc_mdstr_from_string(headers->headers[i].value))); grpc_mdstr_from_string(headers->headers[i].value)));
} }
s->state.state_callback_received[OP_RECV_INITIAL_METADATA] = true; s->state.state_callback_received[OP_RECV_INITIAL_METADATA] = true;
...@@ -507,8 +507,8 @@ static void on_response_trailers_received( ...@@ -507,8 +507,8 @@ static void on_response_trailers_received(
trailers->headers[i].value); trailers->headers[i].value);
grpc_chttp2_incoming_metadata_buffer_add( grpc_chttp2_incoming_metadata_buffer_add(
&s->state.rs.trailing_metadata, &s->state.rs.trailing_metadata,
grpc_mdelem_from_metadata_strings(&exec_ctx, grpc_mdelem_from_metadata_strings(
grpc_mdstr_from_string(trailers->headers[i].key), &exec_ctx, grpc_mdstr_from_string(trailers->headers[i].key),
grpc_mdstr_from_string(trailers->headers[i].value))); grpc_mdstr_from_string(trailers->headers[i].value)));
s->state.rs.trailing_metadata_valid = true; s->state.rs.trailing_metadata_valid = true;
} }
......
...@@ -50,7 +50,8 @@ typedef struct { ...@@ -50,7 +50,8 @@ typedef struct {
char *secure_peer_name; char *secure_peer_name;
} grpc_httpcli_ssl_channel_security_connector; } grpc_httpcli_ssl_channel_security_connector;
static void httpcli_ssl_destroy(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { static void httpcli_ssl_destroy(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc) {
grpc_httpcli_ssl_channel_security_connector *c = grpc_httpcli_ssl_channel_security_connector *c =
(grpc_httpcli_ssl_channel_security_connector *)sc; (grpc_httpcli_ssl_channel_security_connector *)sc;
if (c->handshaker_factory != NULL) { if (c->handshaker_factory != NULL) {
...@@ -103,8 +104,9 @@ static grpc_security_connector_vtable httpcli_ssl_vtable = { ...@@ -103,8 +104,9 @@ static grpc_security_connector_vtable httpcli_ssl_vtable = {
httpcli_ssl_destroy, httpcli_ssl_check_peer}; httpcli_ssl_destroy, httpcli_ssl_check_peer};
static grpc_security_status httpcli_ssl_channel_security_connector_create( static grpc_security_status httpcli_ssl_channel_security_connector_create(
grpc_exec_ctx *exec_ctx, const unsigned char *pem_root_certs, size_t pem_root_certs_size, grpc_exec_ctx *exec_ctx, const unsigned char *pem_root_certs,
const char *secure_peer_name, grpc_channel_security_connector **sc) { size_t pem_root_certs_size, const char *secure_peer_name,
grpc_channel_security_connector **sc) {
tsi_result result = TSI_OK; tsi_result result = TSI_OK;
grpc_httpcli_ssl_channel_security_connector *c; grpc_httpcli_ssl_channel_security_connector *c;
...@@ -183,14 +185,14 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg, ...@@ -183,14 +185,14 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg,
c->arg = arg; c->arg = arg;
c->handshake_mgr = grpc_handshake_manager_create(); c->handshake_mgr = grpc_handshake_manager_create();
GPR_ASSERT(httpcli_ssl_channel_security_connector_create( GPR_ASSERT(httpcli_ssl_channel_security_connector_create(
exec_ctx, pem_root_certs, pem_root_certs_size, host, &sc) == exec_ctx, pem_root_certs, pem_root_certs_size, host, &sc) ==
GRPC_SECURITY_OK); GRPC_SECURITY_OK);
grpc_channel_security_connector_create_handshakers(exec_ctx, sc, grpc_channel_security_connector_create_handshakers(exec_ctx, sc,
c->handshake_mgr); c->handshake_mgr);
grpc_handshake_manager_do_handshake( grpc_handshake_manager_do_handshake(
exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline, exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline,
NULL /* acceptor */, on_handshake_done, c /* user_data */); NULL /* acceptor */, on_handshake_done, c /* user_data */);
GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx,&sc->base, "httpcli"); GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &sc->base, "httpcli");
} }
const grpc_httpcli_handshaker grpc_httpcli_ssl = {"https", ssl_handshake}; const grpc_httpcli_handshaker grpc_httpcli_ssl = {"https", ssl_handshake};
...@@ -171,7 +171,8 @@ grpc_security_connector *grpc_security_connector_ref( ...@@ -171,7 +171,8 @@ grpc_security_connector *grpc_security_connector_ref(
} }
#ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG #ifdef GRPC_SECURITY_CONNECTOR_REFCOUNT_DEBUG
void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc, void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc,
const char *file, int line, const char *file, int line,
const char *reason) { const char *reason) {
if (sc == NULL) return; if (sc == NULL) return;
...@@ -179,7 +180,8 @@ void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connec ...@@ -179,7 +180,8 @@ void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connec
"SECURITY_CONNECTOR:%p unref %d -> %d %s", sc, "SECURITY_CONNECTOR:%p unref %d -> %d %s", sc,
(int)sc->refcount.count, (int)sc->refcount.count - 1, reason); (int)sc->refcount.count, (int)sc->refcount.count - 1, reason);
#else #else
void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc) {
if (sc == NULL) return; if (sc == NULL) return;
#endif #endif
if (gpr_unref(&sc->refcount)) sc->vtable->destroy(exec_ctx, sc); if (gpr_unref(&sc->refcount)) sc->vtable->destroy(exec_ctx, sc);
...@@ -232,13 +234,17 @@ grpc_security_connector *grpc_find_security_connector_in_args( ...@@ -232,13 +234,17 @@ grpc_security_connector *grpc_find_security_connector_in_args(
/* -- Fake implementation. -- */ /* -- Fake implementation. -- */
static void fake_channel_destroy(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { static void fake_channel_destroy(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc) {
grpc_channel_security_connector *c = (grpc_channel_security_connector *)sc; grpc_channel_security_connector *c = (grpc_channel_security_connector *)sc;
grpc_call_credentials_unref(exec_ctx, c->request_metadata_creds); grpc_call_credentials_unref(exec_ctx, c->request_metadata_creds);
gpr_free(sc); gpr_free(sc);
} }
static void fake_server_destroy(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { gpr_free(sc); } static void fake_server_destroy(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc) {
gpr_free(sc);
}
static void fake_check_peer(grpc_exec_ctx *exec_ctx, static void fake_check_peer(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc, tsi_peer peer, grpc_security_connector *sc, tsi_peer peer,
...@@ -346,7 +352,8 @@ typedef struct { ...@@ -346,7 +352,8 @@ typedef struct {
tsi_ssl_handshaker_factory *handshaker_factory; tsi_ssl_handshaker_factory *handshaker_factory;
} grpc_ssl_server_security_connector; } grpc_ssl_server_security_connector;
static void ssl_channel_destroy(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { static void ssl_channel_destroy(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc) {
grpc_ssl_channel_security_connector *c = grpc_ssl_channel_security_connector *c =
(grpc_ssl_channel_security_connector *)sc; (grpc_ssl_channel_security_connector *)sc;
grpc_call_credentials_unref(exec_ctx, c->base.request_metadata_creds); grpc_call_credentials_unref(exec_ctx, c->base.request_metadata_creds);
...@@ -358,7 +365,8 @@ static void ssl_channel_destroy(grpc_exec_ctx *exec_ctx, grpc_security_connector ...@@ -358,7 +365,8 @@ static void ssl_channel_destroy(grpc_exec_ctx *exec_ctx, grpc_security_connector
gpr_free(sc); gpr_free(sc);
} }
static void ssl_server_destroy(grpc_exec_ctx *exec_ctx, grpc_security_connector *sc) { static void ssl_server_destroy(grpc_exec_ctx *exec_ctx,
grpc_security_connector *sc) {
grpc_ssl_server_security_connector *c = grpc_ssl_server_security_connector *c =
(grpc_ssl_server_security_connector *)sc; (grpc_ssl_server_security_connector *)sc;
if (c->handshaker_factory != NULL) { if (c->handshaker_factory != NULL) {
...@@ -661,8 +669,8 @@ size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) { ...@@ -661,8 +669,8 @@ size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) {
return GRPC_SLICE_LENGTH(default_pem_root_certs); return GRPC_SLICE_LENGTH(default_pem_root_certs);
} }
grpc_security_status grpc_ssl_channel_security_connector_create(grpc_exec_ctx *exec_ctx, grpc_security_status grpc_ssl_channel_security_connector_create(
grpc_call_credentials *request_metadata_creds, grpc_exec_ctx *exec_ctx, grpc_call_credentials *request_metadata_creds,
const grpc_ssl_config *config, const char *target_name, const grpc_ssl_config *config, const char *target_name,
const char *overridden_target_name, grpc_channel_security_connector **sc) { const char *overridden_target_name, grpc_channel_security_connector **sc) {
size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions(); size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions();
...@@ -739,7 +747,8 @@ error: ...@@ -739,7 +747,8 @@ error:
} }
grpc_security_status grpc_ssl_server_security_connector_create( grpc_security_status grpc_ssl_server_security_connector_create(
grpc_exec_ctx *exec_ctx, const grpc_ssl_server_config *config, grpc_server_security_connector **sc) { grpc_exec_ctx *exec_ctx, const grpc_ssl_server_config *config,
grpc_server_security_connector **sc) {
size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions(); size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions();
const unsigned char **alpn_protocol_strings = const unsigned char **alpn_protocol_strings =
gpr_malloc(sizeof(const char *) * num_alpn_protocols); gpr_malloc(sizeof(const char *) * num_alpn_protocols);
......
...@@ -100,7 +100,8 @@ static void security_handshaker_unref(grpc_exec_ctx *exec_ctx, ...@@ -100,7 +100,8 @@ static void security_handshaker_unref(grpc_exec_ctx *exec_ctx,
// Set args fields to NULL, saving the endpoint and read buffer for // Set args fields to NULL, saving the endpoint and read buffer for
// later destruction. // later destruction.
static void cleanup_args_for_failure_locked(grpc_exec_ctx *exec_ctx, security_handshaker *h) { static void cleanup_args_for_failure_locked(grpc_exec_ctx *exec_ctx,
security_handshaker *h) {
h->endpoint_to_destroy = h->args->endpoint; h->endpoint_to_destroy = h->args->endpoint;
h->args->endpoint = NULL; h->args->endpoint = NULL;
h->read_buffer_to_destroy = h->args->read_buffer; h->read_buffer_to_destroy = h->args->read_buffer;
......
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