diff options
author | 2017-09-07 09:54:28 -0700 | |
---|---|---|
committer | 2017-09-07 09:54:28 -0700 | |
commit | c88e1dee435817f644c55a7087b085dd4927727a (patch) | |
tree | b06a59a99a6b304aa93899ef9ffb53cc206d0a0f /test/core/security | |
parent | e12f5f28b5052330b984ab2e42078efe78141ad0 (diff) |
fix secure_endpoint_test
Diffstat (limited to 'test/core/security')
-rw-r--r-- | test/core/security/secure_endpoint_test.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index 2145d55da7..e9f2c76738 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -44,9 +44,11 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( tsi_frame_protector *fake_write_protector = tsi_create_fake_frame_protector(NULL); tsi_zero_copy_grpc_protector *fake_read_zero_copy_protector = - tsi_create_fake_zero_copy_grpc_protector(NULL); + use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(NULL) + : NULL; tsi_zero_copy_grpc_protector *fake_write_zero_copy_protector = - tsi_create_fake_zero_copy_grpc_protector(NULL); + use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(NULL) + : NULL; grpc_endpoint_test_fixture f; grpc_endpoint_pair tcp; @@ -59,12 +61,9 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset); if (leftover_nslices == 0) { - f.client_ep = - use_zero_copy_protector - ? grpc_secure_endpoint_create(NULL, fake_read_zero_copy_protector, - tcp.client, NULL, 0) - : grpc_secure_endpoint_create(fake_read_protector, NULL, tcp.client, - NULL, 0); + f.client_ep = grpc_secure_endpoint_create(fake_read_protector, + fake_read_zero_copy_protector, + tcp.client, NULL, 0); } else { unsigned i; tsi_result result; @@ -105,22 +104,16 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( } while (still_pending_size > 0); encrypted_leftover = grpc_slice_from_copied_buffer( (const char *)encrypted_buffer, total_buffer_size - buffer_size); - f.client_ep = - use_zero_copy_protector - ? grpc_secure_endpoint_create(NULL, fake_read_zero_copy_protector, - tcp.client, &encrypted_leftover, 1) - : grpc_secure_endpoint_create(fake_read_protector, NULL, tcp.client, - &encrypted_leftover, 1); + f.client_ep = grpc_secure_endpoint_create( + fake_read_protector, fake_read_zero_copy_protector, tcp.client, + &encrypted_leftover, 1); grpc_slice_unref(encrypted_leftover); gpr_free(encrypted_buffer); } - f.server_ep = - use_zero_copy_protector - ? grpc_secure_endpoint_create(NULL, fake_write_zero_copy_protector, - tcp.server, NULL, 0) - : grpc_secure_endpoint_create(fake_write_protector, NULL, tcp.server, - NULL, 0); + f.server_ep = grpc_secure_endpoint_create(fake_write_protector, + fake_write_zero_copy_protector, + tcp.server, NULL, 0); grpc_exec_ctx_finish(&exec_ctx); return f; } |