Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/grpc/proxy_flow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ void ProxyFlow::StartUpstreamWritesDone(std::shared_ptr<ProxyFlow> 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;
}
}));
Expand All @@ -300,7 +300,7 @@ void ProxyFlow::StartUpstreamWriteMessage(std::shared_ptr<ProxyFlow> 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
Expand Down Expand Up @@ -362,7 +362,7 @@ void ProxyFlow::StartUpstreamReadMessage(std::shared_ptr<ProxyFlow> 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);
Expand Down Expand Up @@ -392,8 +392,7 @@ void ProxyFlow::StartDownstreamWriteMessage(std::shared_ptr<ProxyFlow> flow) {
});
}

void ProxyFlow::StartUpstreamFinish(std::shared_ptr<ProxyFlow> flow,
Status status) {
void ProxyFlow::StartUpstreamFinish(std::shared_ptr<ProxyFlow> flow) {
{
std::lock_guard<std::mutex> lock(flow->mu_);
if (flow->started_upstream_finish_) {
Expand All @@ -404,7 +403,7 @@ void ProxyFlow::StartUpstreamFinish(std::shared_ptr<ProxyFlow> 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<ProxyFlow> flow,
Expand Down
3 changes: 1 addition & 2 deletions src/grpc/proxy_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ class ProxyFlow {
std::shared_ptr<ProxyFlow> flow);
static void StartUpstreamReadMessage(std::shared_ptr<ProxyFlow> flow);
static void StartDownstreamWriteMessage(std::shared_ptr<ProxyFlow> flow);
static void StartUpstreamFinish(std::shared_ptr<ProxyFlow> flow,
utils::Status status);
static void StartUpstreamFinish(std::shared_ptr<ProxyFlow> flow);
static void StartDownstreamFinish(std::shared_ptr<ProxyFlow> flow,
utils::Status status);

Expand Down
5 changes: 2 additions & 3 deletions src/nginx/t/grpc_interop_cancel.t
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
);

Expand Down