From 4e520597e54a8b78fddbb91e360d8657468d0a38 Mon Sep 17 00:00:00 2001 From: Makdharma Date: Fri, 26 Aug 2016 16:01:20 -0700 Subject: [PATCH] fixed bug exposed by h2_proxy* test. --- src/core/lib/channel/http_client_filter.c | 2 +- src/core/lib/channel/http_server_filter.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index d40bd204d7e..0d3f4168611 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -217,7 +217,7 @@ static void hc_mutate_op(grpc_call_element *elem, op->recv_initial_metadata_ready = &calld->hc_on_recv; } - if (op->on_complete != NULL) { + if (op->on_complete != NULL && op->send_message != NULL) { calld->on_complete = op->on_complete; op->on_complete = &calld->hc_on_complete; } diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index a767af57e9d..26a232bd7b0 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -251,11 +251,6 @@ static void hs_mutate_op(grpc_call_element *elem, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC); } - if (op->on_complete) { - calld->on_complete = op->on_complete; - op->on_complete = &calld->hs_on_complete; - } - if (op->recv_initial_metadata) { /* substitute our callback for the higher callback */ GPR_ASSERT(op->recv_idempotent_request != NULL); @@ -271,6 +266,10 @@ static void hs_mutate_op(grpc_call_element *elem, if (op->recv_message_ready) { op->recv_message_ready = &calld->hs_recv_message_ready; } + if (op->on_complete) { + calld->on_complete = op->on_complete; + op->on_complete = &calld->hs_on_complete; + } } }