Skip to content
Snippets Groups Projects
Commit d1abc814 authored by Craig Tiller's avatar Craig Tiller
Browse files

Throw away queued messages on error

parent ae35546d
No related branches found
No related tags found
No related merge requests found
...@@ -375,18 +375,10 @@ void grpc_call_internal_unref(grpc_call *c, int allow_immediate_deletion) { ...@@ -375,18 +375,10 @@ void grpc_call_internal_unref(grpc_call *c, int allow_immediate_deletion) {
static void set_status_code(grpc_call *call, status_source source, static void set_status_code(grpc_call *call, status_source source,
gpr_uint32 status) { gpr_uint32 status) {
int flush;
call->status[source].is_set = 1; call->status[source].is_set = 1;
call->status[source].code = status; call->status[source].code = status;
if (call->is_client) { if (status != GRPC_STATUS_OK && !grpc_bbq_empty(&call->incoming_queue)) {
flush = status == GRPC_STATUS_CANCELLED;
} else {
flush = status != GRPC_STATUS_OK;
}
if (flush && !grpc_bbq_empty(&call->incoming_queue)) {
grpc_bbq_flush(&call->incoming_queue); grpc_bbq_flush(&call->incoming_queue);
} }
} }
......
...@@ -198,7 +198,7 @@ static void test_request_response_with_metadata_and_payload( ...@@ -198,7 +198,7 @@ static void test_request_response_with_metadata_and_payload(
op++; op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op++; op++;
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
...@@ -215,7 +215,7 @@ static void test_request_response_with_metadata_and_payload( ...@@ -215,7 +215,7 @@ static void test_request_response_with_metadata_and_payload(
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
......
...@@ -184,7 +184,7 @@ static void test_request_response_with_metadata_and_payload( ...@@ -184,7 +184,7 @@ static void test_request_response_with_metadata_and_payload(
op++; op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op++; op++;
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
...@@ -201,7 +201,7 @@ static void test_request_response_with_metadata_and_payload( ...@@ -201,7 +201,7 @@ static void test_request_response_with_metadata_and_payload(
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
......
...@@ -175,7 +175,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { ...@@ -175,7 +175,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
op++; op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op++; op++;
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
...@@ -192,7 +192,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { ...@@ -192,7 +192,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) {
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
......
...@@ -184,7 +184,7 @@ static void test_request_response_with_metadata_and_payload( ...@@ -184,7 +184,7 @@ static void test_request_response_with_metadata_and_payload(
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 2; op->data.send_status_from_server.trailing_metadata_count = 2;
op->data.send_status_from_server.trailing_metadata = meta_t; op->data.send_status_from_server.trailing_metadata = meta_t;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op++; op++;
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
...@@ -201,7 +201,7 @@ static void test_request_response_with_metadata_and_payload( ...@@ -201,7 +201,7 @@ static void test_request_response_with_metadata_and_payload(
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
......
...@@ -176,7 +176,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { ...@@ -176,7 +176,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
op++; op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op++; op++;
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
...@@ -193,7 +193,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { ...@@ -193,7 +193,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) {
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
......
...@@ -167,7 +167,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { ...@@ -167,7 +167,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
op++; op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz"; op->data.send_status_from_server.status_details = "xyz";
op++; op++;
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
...@@ -184,7 +184,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { ...@@ -184,7 +184,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
cq_expect_completion(v_client, tag(1), GRPC_OP_OK); cq_expect_completion(v_client, tag(1), GRPC_OP_OK);
cq_verify(v_client); cq_verify(v_client);
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(status == GRPC_STATUS_OK);
GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(details, "xyz"));
GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment