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; + } } }