|
|
@ -44,9 +44,11 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( |
|
|
|
tsi_frame_protector *fake_write_protector = |
|
|
|
tsi_frame_protector *fake_write_protector = |
|
|
|
tsi_create_fake_frame_protector(NULL); |
|
|
|
tsi_create_fake_frame_protector(NULL); |
|
|
|
tsi_zero_copy_grpc_protector *fake_read_zero_copy_protector = |
|
|
|
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_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_test_fixture f; |
|
|
|
grpc_endpoint_pair tcp; |
|
|
|
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); |
|
|
|
grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset); |
|
|
|
|
|
|
|
|
|
|
|
if (leftover_nslices == 0) { |
|
|
|
if (leftover_nslices == 0) { |
|
|
|
f.client_ep = |
|
|
|
f.client_ep = grpc_secure_endpoint_create(fake_read_protector, |
|
|
|
use_zero_copy_protector |
|
|
|
fake_read_zero_copy_protector, |
|
|
|
? grpc_secure_endpoint_create(NULL, fake_read_zero_copy_protector, |
|
|
|
tcp.client, NULL, 0); |
|
|
|
tcp.client, NULL, 0) |
|
|
|
|
|
|
|
: grpc_secure_endpoint_create(fake_read_protector, NULL, tcp.client, |
|
|
|
|
|
|
|
NULL, 0); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
unsigned i; |
|
|
|
unsigned i; |
|
|
|
tsi_result result; |
|
|
|
tsi_result result; |
|
|
@ -105,22 +104,16 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( |
|
|
|
} while (still_pending_size > 0); |
|
|
|
} while (still_pending_size > 0); |
|
|
|
encrypted_leftover = grpc_slice_from_copied_buffer( |
|
|
|
encrypted_leftover = grpc_slice_from_copied_buffer( |
|
|
|
(const char *)encrypted_buffer, total_buffer_size - buffer_size); |
|
|
|
(const char *)encrypted_buffer, total_buffer_size - buffer_size); |
|
|
|
f.client_ep = |
|
|
|
f.client_ep = grpc_secure_endpoint_create( |
|
|
|
use_zero_copy_protector |
|
|
|
fake_read_protector, fake_read_zero_copy_protector, tcp.client, |
|
|
|
? grpc_secure_endpoint_create(NULL, fake_read_zero_copy_protector, |
|
|
|
&encrypted_leftover, 1); |
|
|
|
tcp.client, &encrypted_leftover, 1) |
|
|
|
|
|
|
|
: grpc_secure_endpoint_create(fake_read_protector, NULL, tcp.client, |
|
|
|
|
|
|
|
&encrypted_leftover, 1); |
|
|
|
|
|
|
|
grpc_slice_unref(encrypted_leftover); |
|
|
|
grpc_slice_unref(encrypted_leftover); |
|
|
|
gpr_free(encrypted_buffer); |
|
|
|
gpr_free(encrypted_buffer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
f.server_ep = |
|
|
|
f.server_ep = grpc_secure_endpoint_create(fake_write_protector, |
|
|
|
use_zero_copy_protector |
|
|
|
fake_write_zero_copy_protector, |
|
|
|
? grpc_secure_endpoint_create(NULL, fake_write_zero_copy_protector, |
|
|
|
tcp.server, NULL, 0); |
|
|
|
tcp.server, NULL, 0) |
|
|
|
|
|
|
|
: grpc_secure_endpoint_create(fake_write_protector, NULL, tcp.server, |
|
|
|
|
|
|
|
NULL, 0); |
|
|
|
|
|
|
|
grpc_exec_ctx_finish(&exec_ctx); |
|
|
|
grpc_exec_ctx_finish(&exec_ctx); |
|
|
|
return f; |
|
|
|
return f; |
|
|
|
} |
|
|
|
} |
|
|
|