Skip to content

Commit f7ead37

Browse files
committed
Fix data race on g3
1 parent 9cff0f3 commit f7ead37

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

test/core/tsi/transport_security_test_lib.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,24 +303,25 @@ void tsi_test_frame_protector_receive_message_from_peer(
303303
gpr_free(message_buffer);
304304
}
305305

306-
grpc_error_handle on_handshake_next_done(
306+
void on_handshake_next_done(
307307
tsi_result result, void* user_data, const unsigned char* bytes_to_send,
308308
size_t bytes_to_send_size, tsi_handshaker_result* handshaker_result) {
309309
handshaker_args* args = static_cast<handshaker_args*>(user_data);
310310
GRPC_CHECK_NE(args, nullptr);
311311
GRPC_CHECK_NE(args->fixture, nullptr);
312312
tsi_test_fixture* fixture = args->fixture;
313-
grpc_error_handle error;
314313
// Read more data if we need to.
315314
if (result == TSI_INCOMPLETE_DATA) {
316315
GRPC_CHECK_EQ(bytes_to_send_size, 0u);
316+
args->error = absl::OkStatus();
317317
notification_signal(fixture);
318-
return error;
318+
return;
319319
}
320320
if (result != TSI_OK) {
321-
notification_signal(fixture);
322-
return GRPC_ERROR_CREATE(
321+
args->error = GRPC_ERROR_CREATE(
323322
absl::StrCat("Handshake failed (", tsi_result_to_string(result), ")"));
323+
notification_signal(fixture);
324+
return;
324325
}
325326
// Update handshaker result.
326327
if (handshaker_result != nullptr) {
@@ -338,8 +339,8 @@ grpc_error_handle on_handshake_next_done(
338339
if (handshaker_result != nullptr) {
339340
maybe_append_unused_bytes(args);
340341
}
342+
args->error = absl::OkStatus();
341343
notification_signal(fixture);
342-
return error;
343344
}
344345

345346
static void on_handshake_next_done_wrapper(
@@ -388,6 +389,8 @@ static void do_handshaker_next(
388389
const_cast<const unsigned char**>(&bytes_to_send), &bytes_to_send_size,
389390
&handshaker_result, &on_handshake_next_done_wrapper, args);
390391
if (result != TSI_ASYNC) {
392+
on_handshake_next_done(result, args, bytes_to_send, bytes_to_send_size,
393+
handshaker_result);
391394
args->error = on_handshake_next_done(
392395
result, args, bytes_to_send, bytes_to_send_size, handshaker_result);
393396
if (!args->error.ok()) {

0 commit comments

Comments
 (0)