aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/bad_client
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-01-30 15:25:05 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-01-30 15:25:05 -0800
commit83ad85e2faa0e980ed51b1979c4e6486ec1afd3b (patch)
tree1094855c130b2f6749768a77940dc8fefd38f539 /test/core/bad_client
parent54f6092eff6348db952ea4eac48888d57c2806e7 (diff)
Remove unnecessary check and few more comments
Diffstat (limited to 'test/core/bad_client')
-rw-r--r--test/core/bad_client/bad_client.cc10
-rw-r--r--test/core/bad_client/bad_client.h4
2 files changed, 9 insertions, 5 deletions
diff --git a/test/core/bad_client/bad_client.cc b/test/core/bad_client/bad_client.cc
index 6a35ffcb6d..df803d16a2 100644
--- a/test/core/bad_client/bad_client.cc
+++ b/test/core/bad_client/bad_client.cc
@@ -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),
nullptr)
.type == GRPC_QUEUE_TIMEOUT);
- } while (!gpr_event_get(&read_done_event) ||
- !gpr_event_get(&done_write));
+ } while (!gpr_event_get(&read_done_event));
if (arg->client_validator(&incoming, arg->client_validator_arg)) break;
gpr_log(GPR_INFO,
"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();
}
- /* If flags is non-zero, it is time to shutdown the client */
- if (flags) {
+ /* If the request was too large, then we need to forcefully shut down the
+ * client, so that the write can be considered completed */
+ if (flags & GRPC_BAD_CLIENT_LARGE_REQUEST) {
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)) {
GPR_ASSERT(
grpc_completion_queue_next(
diff --git a/test/core/bad_client/bad_client.h b/test/core/bad_client/bad_client.h
index 46f25269ca..de7d830cd7 100644
--- a/test/core/bad_client/bad_client.h
+++ b/test/core/bad_client/bad_client.h
@@ -44,6 +44,7 @@ struct grpc_bad_client_arg {
size_t client_payload_length;
};
+/* Flags for grpc_run_bad_client_test */
#define GRPC_BAD_CLIENT_DISCONNECT 1
#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.
* Also execute \a server_validator in a separate thread to assert that the
* 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(
grpc_bad_client_server_side_validator server_validator,