Address Julien's comment and clang format

pull/10925/head
jiangtaoli2016 8 years ago
parent 18836bec50
commit 30f2a40f10
  1. 20
      src/core/lib/security/transport/security_connector.c
  2. 5
      src/core/lib/security/transport/security_handshaker.c

@ -389,22 +389,22 @@ static void fake_channel_add_handshakers(
grpc_exec_ctx *exec_ctx, grpc_channel_security_connector *sc, grpc_exec_ctx *exec_ctx, grpc_channel_security_connector *sc,
grpc_handshake_manager *handshake_mgr) { grpc_handshake_manager *handshake_mgr) {
grpc_handshake_manager_add( grpc_handshake_manager_add(
handshake_mgr, grpc_security_handshaker_create( handshake_mgr,
exec_ctx, grpc_security_handshaker_create(
tsi_create_adapter_handshaker( exec_ctx, tsi_create_adapter_handshaker(
tsi_create_fake_handshaker(true /* is_client */)), tsi_create_fake_handshaker(true /* is_client */)),
&sc->base)); &sc->base));
} }
static void fake_server_add_handshakers(grpc_exec_ctx *exec_ctx, static void fake_server_add_handshakers(grpc_exec_ctx *exec_ctx,
grpc_server_security_connector *sc, grpc_server_security_connector *sc,
grpc_handshake_manager *handshake_mgr) { grpc_handshake_manager *handshake_mgr) {
grpc_handshake_manager_add( grpc_handshake_manager_add(
handshake_mgr, grpc_security_handshaker_create( handshake_mgr,
exec_ctx, grpc_security_handshaker_create(
tsi_create_adapter_handshaker( exec_ctx, tsi_create_adapter_handshaker(
tsi_create_fake_handshaker(false /* is_client */)), tsi_create_fake_handshaker(false /* is_client */)),
&sc->base)); &sc->base));
} }
static grpc_security_connector_vtable fake_channel_vtable = { static grpc_security_connector_vtable fake_channel_vtable = {

@ -233,13 +233,14 @@ static grpc_error *on_handshake_next_done_locked(
// Send data to peer. // Send data to peer.
grpc_slice to_send = grpc_slice_from_copied_buffer( grpc_slice to_send = grpc_slice_from_copied_buffer(
(const char *)bytes_to_send, bytes_to_send_size); (const char *)bytes_to_send, bytes_to_send_size);
grpc_slice_buffer_reset_and_unref(&h->outgoing); grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &h->outgoing);
grpc_slice_buffer_add(&h->outgoing, to_send); grpc_slice_buffer_add(&h->outgoing, to_send);
grpc_endpoint_write(exec_ctx, h->args->endpoint, &h->outgoing, grpc_endpoint_write(exec_ctx, h->args->endpoint, &h->outgoing,
&h->on_handshake_data_sent_to_peer); &h->on_handshake_data_sent_to_peer);
// If handshake has completed, check peer and so on. // If handshake has completed, check peer and so on.
if (handshaker_result != NULL) { if (handshaker_result != NULL) {
GPR_ASSERT(h->handshaker_result == NULL);
h->handshaker_result = handshaker_result; h->handshaker_result = handshaker_result;
error = check_peer_locked(exec_ctx, h); error = check_peer_locked(exec_ctx, h);
} }
@ -301,7 +302,7 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
security_handshaker_unref(exec_ctx, h); security_handshaker_unref(exec_ctx, h);
return; return;
} }
// Copy all slides received. // Copy all slices received.
size_t i; size_t i;
size_t bytes_received_size = 0; size_t bytes_received_size = 0;
for (i = 0; i < h->args->read_buffer->count; i++) { for (i = 0; i < h->args->read_buffer->count; i++) {

Loading…
Cancel
Save