diff options
author | Mark D. Roth <roth@google.com> | 2017-06-22 10:49:43 -0700 |
---|---|---|
committer | Mark D. Roth <roth@google.com> | 2017-06-22 10:49:43 -0700 |
commit | 7cd1425e29274a32bdbf253a586dbca2318dfb29 (patch) | |
tree | c1f5b9ac6b73f242b8fb86b792494bc571fb8eb3 /src/core/ext | |
parent | 4d5f30d9dbaae495c5a4f34c50b460e5d5c935eb (diff) |
Fix handling of send_message before send_initial_metadata in compress filter.
Diffstat (limited to 'src/core/ext')
-rw-r--r-- | src/core/ext/filters/http/message_compress/message_compress_filter.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 04cb1d94f8..71a8bc5bec 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -255,6 +255,23 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, } } +static void handle_send_message_batch(grpc_exec_ctx *exec_ctx, + grpc_call_element *elem, + grpc_transport_stream_op_batch *op, + bool has_compression_algorithm) { + call_data *calld = elem->call_data; + if (!skip_compression(elem, op->payload->send_message.send_message->flags, + has_compression_algorithm)) { + calld->send_op = op; + calld->send_length = op->payload->send_message.send_message->length; + calld->send_flags = op->payload->send_message.send_message->flags; + continue_send_message(exec_ctx, elem); + } else { + /* pass control down the stack */ + grpc_call_next_op(exec_ctx, elem, op); + } +} + static void compress_start_transport_stream_op_batch( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { @@ -307,8 +324,9 @@ static void compress_start_transport_stream_op_batch( goto retry_send_im; } if (cur != INITIAL_METADATA_UNSEEN) { - grpc_call_next_op(exec_ctx, elem, - (grpc_transport_stream_op_batch *)cur); + handle_send_message_batch(exec_ctx, elem, + (grpc_transport_stream_op_batch *)cur, + has_compression_algorithm); } } } @@ -325,17 +343,8 @@ static void compress_start_transport_stream_op_batch( break; case HAS_COMPRESSION_ALGORITHM: case NO_COMPRESSION_ALGORITHM: - if (!skip_compression(elem, - op->payload->send_message.send_message->flags, - cur == HAS_COMPRESSION_ALGORITHM)) { - calld->send_op = op; - calld->send_length = op->payload->send_message.send_message->length; - calld->send_flags = op->payload->send_message.send_message->flags; - continue_send_message(exec_ctx, elem); - } else { - /* pass control down the stack */ - grpc_call_next_op(exec_ctx, elem, op); - } + handle_send_message_batch(exec_ctx, elem, op, + cur == HAS_COMPRESSION_ALGORITHM); break; default: if (cur & CANCELLED_BIT) { |