From 3651424ea4208624e43c46e443a1d3fecd2369c0 Mon Sep 17 00:00:00 2001 From: Ashitha Santhosh Date: Wed, 25 Mar 2020 03:01:07 -0700 Subject: [PATCH] Moved k[Min/Max]FrameSize variables to header file. --- src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc | 6 ++---- src/core/tsi/alts/handshaker/alts_tsi_handshaker.h | 5 +++++ test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc | 7 ++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc index c9daaecbce6..b2687825d17 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc @@ -41,10 +41,8 @@ #include "src/core/tsi/alts/handshaker/alts_tsi_utils.h" #include "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h" -// Frame size negotiation extends send frame size range to -// [kMinFrameSize, kMaxFrameSize] -constexpr size_t kMinFrameSize = 16 * 1024; -constexpr size_t kMaxFrameSize = 128 * 1024; +const size_t kMinFrameSize = 16 * 1024; +const size_t kMaxFrameSize = 128 * 1024; /* Main struct for ALTS TSI handshaker. */ struct alts_tsi_handshaker { diff --git a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h index 0c9a5732c48..6959c563a5e 100644 --- a/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +++ b/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h @@ -38,6 +38,11 @@ const size_t kTsiAltsNumOfPeerProperties = 5; +// Frame size negotiation extends send frame size range to +// [kMinFrameSize, kMaxFrameSize] +ABSL_CONST_INIT extern const size_t kMinFrameSize; +ABSL_CONST_INIT extern const size_t kMaxFrameSize; + typedef struct alts_tsi_handshaker alts_tsi_handshaker; /** diff --git a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc index 0abab1f8ae2..1037313bbec 100644 --- a/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc +++ b/test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc @@ -50,9 +50,7 @@ #define ALTS_TSI_HANDSHAKER_TEST_APPLICATION_PROTOCOL \ "test application protocol" #define ALTS_TSI_HANDSHAKER_TEST_RECORD_PROTOCOL "test record protocol" -#define ALTS_TSI_HANDSHAKER_TEST_MIN_FRAME_SIZE 16 * 1024 #define ALTS_TSI_HANDSHAKER_TEST_MAX_FRAME_SIZE 256 * 1024 -#define ALTS_TSI_HANDSHAKER_TEST_DEFAULT_MAX_FRAME_SIZE 128 * 1024 using grpc_core::internal::alts_handshaker_client_check_fields_for_testing; using grpc_core::internal::alts_handshaker_client_get_handshaker_for_testing; @@ -298,8 +296,7 @@ static void on_client_next_success_cb(tsi_result status, void* user_data, size_t actual_max_frame_size; tsi_zero_copy_grpc_protector_max_frame_size(zero_copy_protector, &actual_max_frame_size); - GPR_ASSERT(actual_max_frame_size == - ALTS_TSI_HANDSHAKER_TEST_DEFAULT_MAX_FRAME_SIZE); + GPR_ASSERT(actual_max_frame_size == kMaxFrameSize); /* Validate peer identity. */ tsi_peer peer; GPR_ASSERT(tsi_handshaker_result_extract_peer(result, &peer) == TSI_OK); @@ -372,7 +369,7 @@ static void on_server_next_success_cb(tsi_result status, void* user_data, size_t actual_max_frame_size; tsi_zero_copy_grpc_protector_max_frame_size(zero_copy_protector, &actual_max_frame_size); - GPR_ASSERT(actual_max_frame_size == ALTS_TSI_HANDSHAKER_TEST_MIN_FRAME_SIZE); + GPR_ASSERT(actual_max_frame_size == kMinFrameSize); /* Validate peer identity. */ tsi_peer peer; GPR_ASSERT(tsi_handshaker_result_extract_peer(result, &peer) == TSI_OK);