Remove unnecessary check and few more comments

pull/14112/head
Yash Tibrewal 7 years ago
parent 54f6092eff
commit 83ad85e2fa
  1. 10
      test/core/bad_client/bad_client.cc
  2. 4
      test/core/bad_client/bad_client.h

@ -153,8 +153,7 @@ void grpc_run_client_side_validator(grpc_bad_client_arg* arg, uint32_t flags,
client_cq, grpc_timeout_milliseconds_to_deadline(100), client_cq, grpc_timeout_milliseconds_to_deadline(100),
nullptr) nullptr)
.type == GRPC_QUEUE_TIMEOUT); .type == GRPC_QUEUE_TIMEOUT);
} while (!gpr_event_get(&read_done_event) || } while (!gpr_event_get(&read_done_event));
!gpr_event_get(&done_write));
if (arg->client_validator(&incoming, arg->client_validator_arg)) break; if (arg->client_validator(&incoming, arg->client_validator_arg)) break;
gpr_log(GPR_INFO, gpr_log(GPR_INFO,
"client validator failed; trying additional read " "client validator failed; trying additional read "
@ -165,12 +164,13 @@ void grpc_run_client_side_validator(grpc_bad_client_arg* arg, uint32_t flags,
grpc_core::ExecCtx::Get()->Flush(); grpc_core::ExecCtx::Get()->Flush();
} }
/* If flags is non-zero, it is time to shutdown the client */ /* If the request was too large, then we need to forcefully shut down the
if (flags) { * client, so that the write can be considered completed */
if (flags & GRPC_BAD_CLIENT_LARGE_REQUEST) {
shutdown_client(&sfd->client); shutdown_client(&sfd->client);
} }
/* Make sure that the server is done writing */ /* Make sure that the client is done writing */
while (!gpr_event_get(&done_write)) { while (!gpr_event_get(&done_write)) {
GPR_ASSERT( GPR_ASSERT(
grpc_completion_queue_next( grpc_completion_queue_next(

@ -44,6 +44,7 @@ struct grpc_bad_client_arg {
size_t client_payload_length; size_t client_payload_length;
}; };
/* Flags for grpc_run_bad_client_test */
#define GRPC_BAD_CLIENT_DISCONNECT 1 #define GRPC_BAD_CLIENT_DISCONNECT 1
#define GRPC_BAD_CLIENT_LARGE_REQUEST 2 #define GRPC_BAD_CLIENT_LARGE_REQUEST 2
@ -53,6 +54,9 @@ struct grpc_bad_client_arg {
* payload, run client_validator to make sure that the response is as expected. * payload, run client_validator to make sure that the response is as expected.
* Also execute \a server_validator in a separate thread to assert that the * Also execute \a server_validator in a separate thread to assert that the
* bytes are handled as expected. * bytes are handled as expected.
*
* The flags are only applicable to the last validator in the array. (This can
* be changed in the future if necessary)
*/ */
void grpc_run_bad_client_test( void grpc_run_bad_client_test(
grpc_bad_client_server_side_validator server_validator, grpc_bad_client_server_side_validator server_validator,

Loading…
Cancel
Save