Skip to content

Commit 3dd70c0

Browse files
committed
Remove shutdown test from the unit tests and fix more comments
1 parent 08455e9 commit 3dd70c0

File tree

3 files changed

+9
-33
lines changed

3 files changed

+9
-33
lines changed

src/core/tsi/ssl_transport_security.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,9 @@ void TlsOffloadSignDoneCallback(
382382
result = async_result.first;
383383
next_args = std::move(async_result.second);
384384
}
385-
if (next_args.has_value()) {
386-
if (next_args->cb != nullptr) {
387-
next_args->cb(result, next_args->user_data, next_args->bytes_to_send,
388-
next_args->bytes_to_send_size,
389-
next_args->handshaker_result);
390-
}
385+
if (next_args.has_value() && next_args->cb != nullptr) {
386+
next_args->cb(result, next_args->user_data, next_args->bytes_to_send,
387+
next_args->bytes_to_send_size, next_args->handshaker_result);
391388
}
392389
}
393390

@@ -434,9 +431,10 @@ enum ssl_private_key_result_t TlsPrivateKeySignWrapper(
434431
// Create the completion callback by binding the current context.
435432
auto done_callback =
436433
absl::bind_front(TlsOffloadSignDoneCallback, handshaker->Ref());
437-
// Call the user's async sign function
438-
// The contract with the user is that they MUST invoke the callback when
439-
// complete in their implementation, and their impl MUST not block.
434+
// Call the user's sign function. It can be sync or async.
435+
// When the user's sign function is async, the contract is that they MUST
436+
// invoke the callback when complete in their implementation, and their impl
437+
// MUST not block.
440438
auto algorithm = ToSignatureAlgorithmClass(signature_algorithm);
441439
if (!algorithm.ok()) {
442440
handshaker->MaybeSetError(algorithm.status().ToString());
@@ -2915,6 +2913,8 @@ tsi_result tsi_create_ssl_client_handshaker_factory_with_options(
29152913
grpc_core::Match(
29162914
options->pem_key_cert_pair->private_key, [](const std::string&) {},
29172915
[&](const std::shared_ptr<grpc_core::PrivateKeySigner>& key_signer) {
2916+
// The Handshaker Factory will own a shared copy of the reference
2917+
// passed through the options.
29182918
impl->base.key_signer = key_signer;
29192919
});
29202920
}

test/core/tsi/private_key_offload_test.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -540,21 +540,6 @@ TEST_P(PrivateKeyOffloadTest, OffloadFailsWithAsyncInvalidSignatureOnClient) {
540540
event_engine_.get());
541541
}
542542

543-
// Verifies that client-side async signing is correctly cancelled when the
544-
// handshaker is shut down.
545-
TEST_P(PrivateKeyOffloadTest, OffloadFailsWithSignCancelledOnClient) {
546-
auto signer = std::make_shared<AsyncTestPrivateKeySigner>(
547-
"", event_engine_, AsyncTestPrivateKeySigner::Mode::kCancellation);
548-
auto fixture = std::make_shared<SslOffloadTsiTestFixture>(
549-
OffloadParty::kClient, std::static_pointer_cast<PrivateKeySigner>(signer),
550-
GetParam());
551-
event_engine_->RunAfter(std::chrono::seconds(1),
552-
[fixture]() { fixture->Shutdown(); });
553-
fixture->Run(/*expect_success=*/false, /*expect_success_on_client*/ false,
554-
event_engine_.get());
555-
EXPECT_TRUE(signer->WasCancelled());
556-
}
557-
558543
std::string TestNameSuffix(
559544
const ::testing::TestParamInfo<tsi_tls_version>& version) {
560545
if (version.param == tsi_tls_version::TSI_TLS1_2) return "TLS_1_2";

test/core/tsi/transport_security_test_lib.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,6 @@ static void do_handshaker_next(
388388
const_cast<const unsigned char**>(&bytes_to_send), &bytes_to_send_size,
389389
&handshaker_result, &on_handshake_next_done_wrapper, args);
390390
if (result != TSI_ASYNC) {
391-
if (event_engine != nullptr) {
392-
event_engine->TickUntilIdle();
393-
}
394391
args->error = on_handshake_next_done(
395392
result, args, bytes_to_send, bytes_to_send_size, handshaker_result);
396393
if (!args->error.ok()) {
@@ -419,16 +416,10 @@ void tsi_test_do_handshake(
419416
client_args->transferred_data = false;
420417
server_args->transferred_data = false;
421418
do_handshaker_next(client_args, event_engine);
422-
if (event_engine != nullptr) {
423-
event_engine->TickUntilIdle();
424-
}
425419
if (!client_args->error.ok()) {
426420
break;
427421
}
428422
do_handshaker_next(server_args, event_engine);
429-
if (event_engine != nullptr) {
430-
event_engine->TickUntilIdle();
431-
}
432423
if (!server_args->error.ok()) {
433424
break;
434425
}

0 commit comments

Comments
 (0)