瀏覽代碼

Post-review change; ensure handshake queue has been initialized in alts_tsi_handshaker_test

Alexander Polcyn 5 年之前
父節點
當前提交
6b62e2d1cc
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/core/tsi/alts/handshaker/alts_handshaker_client.cc

+ 6 - 0
src/core/tsi/alts/handshaker/alts_handshaker_client.cc

@@ -829,6 +829,12 @@ void alts_handshaker_client_ref_for_testing(alts_handshaker_client* c) {
 
 
 void alts_handshaker_client_on_status_received_for_testing(
 void alts_handshaker_client_on_status_received_for_testing(
     alts_handshaker_client* c, grpc_status_code status, grpc_error* error) {
     alts_handshaker_client* c, grpc_status_code status, grpc_error* error) {
+  // We first make sure that the handshake queue has been initialized
+  // here because there are tests that use this API that mock out
+  // other parts of the alts_handshaker_client in such a way that the
+  // code path that would normally ensure that the handshake queue
+  // has been initialized isn't taken.
+  gpr_once_init(&g_queued_handshakes_init, DoHandshakeQueuesInit);
   alts_grpc_handshaker_client* client =
   alts_grpc_handshaker_client* client =
       reinterpret_cast<alts_grpc_handshaker_client*>(c);
       reinterpret_cast<alts_grpc_handshaker_client*>(c);
   client->handshake_status_code = status;
   client->handshake_status_code = status;