diff --git a/src/grpc/proxy_flow.cc b/src/grpc/proxy_flow.cc index 811a13cb9..797dee355 100644 --- a/src/grpc/proxy_flow.cc +++ b/src/grpc/proxy_flow.cc @@ -280,11 +280,11 @@ void ProxyFlow::StartUpstreamWritesDone(std::shared_ptr flow, if (!ok) { // Upstream is not writable, call finish to get status and // and finish the call - StartUpstreamFinish(flow, Status::OK); + StartUpstreamFinish(flow); return; } if (!status.ok()) { - StartUpstreamFinish(flow, status); + StartDownstreamFinish(flow, status); return; } })); @@ -300,7 +300,7 @@ void ProxyFlow::StartUpstreamWriteMessage(std::shared_ptr flow) { if (!ok) { // Upstream is not writable, call finish to get status and // and finish the call - StartUpstreamFinish(flow, Status::OK); + StartUpstreamFinish(flow); return; } // Now that the write has completed, it's safe to start the @@ -362,7 +362,7 @@ void ProxyFlow::StartUpstreamReadMessage(std::shared_ptr flow) { &flow->upstream_to_downstream_buffer_, flow->async_grpc_queue_->MakeTag([flow](bool ok) { if (!ok) { - StartUpstreamFinish(flow, Status::OK); + StartUpstreamFinish(flow); return; } StartDownstreamWriteMessage(flow); @@ -392,8 +392,7 @@ void ProxyFlow::StartDownstreamWriteMessage(std::shared_ptr flow) { }); } -void ProxyFlow::StartUpstreamFinish(std::shared_ptr flow, - Status status) { +void ProxyFlow::StartUpstreamFinish(std::shared_ptr flow) { { std::lock_guard lock(flow->mu_); if (flow->started_upstream_finish_) { @@ -404,7 +403,7 @@ void ProxyFlow::StartUpstreamFinish(std::shared_ptr flow, flow->upstream_reader_writer_->Finish( &flow->status_from_upstream_, flow->async_grpc_queue_->MakeTag( - [flow, status](bool ok) { StartDownstreamFinish(flow, status); })); + [flow](bool ok) { StartDownstreamFinish(flow, Status::OK); })); } void ProxyFlow::StartDownstreamFinish(std::shared_ptr flow, diff --git a/src/grpc/proxy_flow.h b/src/grpc/proxy_flow.h index 3d8671cbe..33ed3b622 100644 --- a/src/grpc/proxy_flow.h +++ b/src/grpc/proxy_flow.h @@ -77,8 +77,7 @@ class ProxyFlow { std::shared_ptr flow); static void StartUpstreamReadMessage(std::shared_ptr flow); static void StartDownstreamWriteMessage(std::shared_ptr flow); - static void StartUpstreamFinish(std::shared_ptr flow, - utils::Status status); + static void StartUpstreamFinish(std::shared_ptr flow); static void StartDownstreamFinish(std::shared_ptr flow, utils::Status status); diff --git a/src/nginx/t/grpc_interop_cancel.t b/src/nginx/t/grpc_interop_cancel.t index 1e9e08adc..3f4dd5aa4 100644 --- a/src/nginx/t/grpc_interop_cancel.t +++ b/src/nginx/t/grpc_interop_cancel.t @@ -44,7 +44,7 @@ my $ServiceControlPort = ApiManager::pick_port(); my $GrpcBackendPort = ApiManager::pick_port(); my $HttpBackendPort = ApiManager::pick_port(); -my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(4); +my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(5); $t->write_file( 'service.pb.txt', @@ -85,8 +85,7 @@ is($t->waitforsocket("127.0.0.1:${Http2NginxPort}"), 1, 'Nginx socket ready.'); ################################################################################ my @test_cases = ( -# Temporary disabled per b/35314304 -# 'cancel_after_begin', + 'cancel_after_begin', 'cancel_after_first_response', );