diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-11-02 11:19:16 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-11-02 11:19:16 -0700 |
commit | aae4ca01a315a69fcf182d09aea1efdfcda13d48 (patch) | |
tree | 0f1b0221bb783291f5f857e7201a858d370cc2db /test/core/tsi | |
parent | 8bd88c459a338bc217332a126c454ea84758c671 (diff) | |
parent | 53417d6e5e62901fd99121ba4f9b8fe76e940e8a (diff) |
Merge master
Diffstat (limited to 'test/core/tsi')
-rw-r--r-- | test/core/tsi/transport_security_test_lib.cc | 37 | ||||
-rw-r--r-- | test/core/tsi/transport_security_test_lib.h | 2 |
2 files changed, 22 insertions, 17 deletions
diff --git a/test/core/tsi/transport_security_test_lib.cc b/test/core/tsi/transport_security_test_lib.cc index 454b79c0cc..b98ab9ba05 100644 --- a/test/core/tsi/transport_security_test_lib.cc +++ b/test/core/tsi/transport_security_test_lib.cc @@ -354,25 +354,28 @@ static void do_handshaker_next(handshaker_args *args) { tsi_handshaker_result *handshaker_result = NULL; unsigned char *bytes_to_send = NULL; size_t bytes_to_send_size = 0; + tsi_result result = TSI_OK; /* Receive data from peer, if available. */ - size_t buf_size = args->handshake_buffer_size; - receive_bytes_from_peer(args->fixture, &args->handshake_buffer, &buf_size, - args->is_client); - if (buf_size > 0) { - args->transferred_data = true; - } - /* Peform handshaker next. */ - tsi_result result = tsi_handshaker_next( - handshaker, args->handshake_buffer, buf_size, - (const unsigned char **)&bytes_to_send, &bytes_to_send_size, - &handshaker_result, &on_handshake_next_done_wrapper, args); - if (result != TSI_ASYNC) { - args->error = on_handshake_next_done(result, args, bytes_to_send, - bytes_to_send_size, handshaker_result); - if (args->error != GRPC_ERROR_NONE) { - return; + do { + size_t buf_size = args->handshake_buffer_size; + receive_bytes_from_peer(args->fixture, &args->handshake_buffer, &buf_size, + args->is_client); + if (buf_size > 0) { + args->transferred_data = true; } - } + /* Peform handshaker next. */ + result = tsi_handshaker_next(handshaker, args->handshake_buffer, buf_size, + (const unsigned char **)&bytes_to_send, + &bytes_to_send_size, &handshaker_result, + &on_handshake_next_done_wrapper, args); + if (result != TSI_ASYNC) { + args->error = on_handshake_next_done( + result, args, bytes_to_send, bytes_to_send_size, handshaker_result); + if (args->error != GRPC_ERROR_NONE) { + return; + } + } + } while (result == TSI_INCOMPLETE_DATA); notification_wait(fixture); } diff --git a/test/core/tsi/transport_security_test_lib.h b/test/core/tsi/transport_security_test_lib.h index 1a04c1f074..49a7a59c58 100644 --- a/test/core/tsi/transport_security_test_lib.h +++ b/test/core/tsi/transport_security_test_lib.h @@ -21,6 +21,8 @@ #include "src/core/tsi/transport_security_interface.h" +#include <grpc/support/sync.h> + #define TSI_TEST_TINY_HANDSHAKE_BUFFER_SIZE 32 #define TSI_TEST_SMALL_HANDSHAKE_BUFFER_SIZE 128 #define TSI_TEST_SMALL_READ_BUFFER_ALLOCATED_SIZE 41 |