Parcourir la source

Minor bug fix

Muxi Yan il y a 8 ans
Parent
commit
b02f1bf6fc
1 fichiers modifiés avec 6 ajouts et 6 suppressions
  1. 6 6
      src/core/ext/transport/chttp2/transport/writing.c

+ 6 - 6
src/core/ext/transport/chttp2/transport/writing.c

@@ -322,10 +322,7 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
                     (send_bytes == s->compressed_data_buffer->length &&
                      s->flow_controlled_buffer.length == 0 &&
                      s->fetching_send_message == NULL);
-                is_last_frame =
-                    is_last_data_frame && s->send_trailing_metadata != NULL &&
-                    grpc_metadata_batch_is_empty(s->send_trailing_metadata);
-                if (is_last_frame && s->stream_compression_ctx) {
+                if (is_last_data_frame && s->stream_compression_ctx) {
                   GPR_ASSERT(grpc_stream_compress(
                       s->stream_compression_ctx, &s->flow_controlled_buffer,
                       s->compressed_data_buffer, NULL, MAX_SIZE_T,
@@ -335,10 +332,13 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
                   s->stream_compression_ctx = NULL;
                   /* After finish, bytes in s->compressed_data_buffer may be
                    * more than max_outgoing. Start another round of the current
-                   * while loop so that send_bytes, is_last_data_frame and
-                   * is_last_frame are recalculated. */
+                   * while loop so that send_bytes and is_last_data_frame are
+                   * recalculated. */
                   continue;
                 }
+                is_last_frame =
+                    is_last_data_frame && s->send_trailing_metadata != NULL &&
+                    grpc_metadata_batch_is_empty(s->send_trailing_metadata);
                 grpc_chttp2_encode_data(s->id, s->compressed_data_buffer,
                                         send_bytes, is_last_frame,
                                         &s->stats.outgoing, &t->outbuf);