clang-format

pull/8720/head^2
Craig Tiller 8 years ago
parent 88e3e7ad90
commit b6821f68b2
  1. 2
      src/core/ext/client_channel/http_connect_handshaker.c
  2. 4
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
  3. 4
      src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
  4. 8
      src/core/ext/transport/cronet/transport/cronet_transport.c
  5. 10
      src/core/lib/http/httpcli_security_connector.c
  6. 27
      src/core/lib/security/transport/security_connector.c
  7. 3
      src/core/lib/security/transport/security_handshaker.c

@ -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
// later destruction.
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->args->endpoint = NULL;
handshaker->read_buffer_to_destroy = handshaker->args->read_buffer;

@ -137,8 +137,8 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
grpc_channel_security_connector *security_connector;
grpc_channel_args *new_args_from_connector;
if (grpc_channel_credentials_create_security_connector(
&exec_ctx, creds, target, args, &security_connector, &new_args_from_connector) !=
GRPC_SECURITY_OK) {
&exec_ctx, creds, target, args, &security_connector,
&new_args_from_connector) != GRPC_SECURITY_OK) {
grpc_exec_ctx_finish(&exec_ctx);
return grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL, "Failed to create security connector.");

@ -67,8 +67,8 @@ static void server_security_handshaker_factory_destroy(
grpc_exec_ctx *exec_ctx, grpc_chttp2_server_handshaker_factory *hf) {
server_security_handshaker_factory *handshaker_factory =
(server_security_handshaker_factory *)hf;
GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &handshaker_factory->security_connector->base,
"server");
GRPC_SECURITY_CONNECTOR_UNREF(
exec_ctx, &handshaker_factory->security_connector->base, "server");
gpr_free(hf);
}

@ -429,8 +429,8 @@ static void on_response_headers_received(
for (size_t i = 0; i < headers->count; i++) {
grpc_chttp2_incoming_metadata_buffer_add(
&s->state.rs.initial_metadata,
grpc_mdelem_from_metadata_strings(&exec_ctx,
grpc_mdstr_from_string(headers->headers[i].key),
grpc_mdelem_from_metadata_strings(
&exec_ctx, grpc_mdstr_from_string(headers->headers[i].key),
grpc_mdstr_from_string(headers->headers[i].value)));
}
s->state.state_callback_received[OP_RECV_INITIAL_METADATA] = true;
@ -507,8 +507,8 @@ static void on_response_trailers_received(
trailers->headers[i].value);
grpc_chttp2_incoming_metadata_buffer_add(
&s->state.rs.trailing_metadata,
grpc_mdelem_from_metadata_strings(&exec_ctx,
grpc_mdstr_from_string(trailers->headers[i].key),
grpc_mdelem_from_metadata_strings(
&exec_ctx, grpc_mdstr_from_string(trailers->headers[i].key),
grpc_mdstr_from_string(trailers->headers[i].value)));
s->state.rs.trailing_metadata_valid = true;
}

@ -50,7 +50,8 @@ typedef struct {
char *secure_peer_name;
} 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 *)sc;
if (c->handshaker_factory != NULL) {
@ -103,8 +104,9 @@ static grpc_security_connector_vtable httpcli_ssl_vtable = {
httpcli_ssl_destroy, httpcli_ssl_check_peer};
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,
const char *secure_peer_name, grpc_channel_security_connector **sc) {
grpc_exec_ctx *exec_ctx, const unsigned char *pem_root_certs,
size_t pem_root_certs_size, const char *secure_peer_name,
grpc_channel_security_connector **sc) {
tsi_result result = TSI_OK;
grpc_httpcli_ssl_channel_security_connector *c;
@ -190,7 +192,7 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg,
grpc_handshake_manager_do_handshake(
exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline,
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};

@ -171,7 +171,8 @@ grpc_security_connector *grpc_security_connector_ref(
}
#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 *reason) {
if (sc == NULL) return;
@ -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,
(int)sc->refcount.count, (int)sc->refcount.count - 1, reason);
#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;
#endif
if (gpr_unref(&sc->refcount)) sc->vtable->destroy(exec_ctx, sc);
@ -232,13 +234,17 @@ grpc_security_connector *grpc_find_security_connector_in_args(
/* -- 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_call_credentials_unref(exec_ctx, c->request_metadata_creds);
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,
grpc_security_connector *sc, tsi_peer peer,
@ -346,7 +352,8 @@ typedef struct {
tsi_ssl_handshaker_factory *handshaker_factory;
} 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 *)sc;
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
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 *)sc;
if (c->handshaker_factory != NULL) {
@ -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);
}
grpc_security_status grpc_ssl_channel_security_connector_create(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *request_metadata_creds,
grpc_security_status grpc_ssl_channel_security_connector_create(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *request_metadata_creds,
const grpc_ssl_config *config, const char *target_name,
const char *overridden_target_name, grpc_channel_security_connector **sc) {
size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions();
@ -739,7 +747,8 @@ error:
}
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();
const unsigned char **alpn_protocol_strings =
gpr_malloc(sizeof(const char *) * num_alpn_protocols);

@ -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
// 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->args->endpoint = NULL;
h->read_buffer_to_destroy = h->args->read_buffer;

Loading…
Cancel
Save