Browse Source

Log error when stream compression fails

Muxi Yan 8 years ago
parent
commit
c353643c37
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/core/ext/transport/chttp2/transport/writing.c

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

@@ -323,10 +323,12 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
                      s->flow_controlled_buffer.length == 0 &&
                      s->flow_controlled_buffer.length == 0 &&
                      s->fetching_send_message == NULL);
                      s->fetching_send_message == NULL);
                 if (is_last_data_frame && s->stream_compression_ctx != NULL) {
                 if (is_last_data_frame && s->stream_compression_ctx != NULL) {
-                  GPR_ASSERT(grpc_stream_compress(
-                      s->stream_compression_ctx, &s->flow_controlled_buffer,
-                      s->compressed_data_buffer, NULL, MAX_SIZE_T,
-                      GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
+                  if (!grpc_stream_compress(
+                          s->stream_compression_ctx, &s->flow_controlled_buffer,
+                          s->compressed_data_buffer, NULL, MAX_SIZE_T,
+                          GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) {
+                    gpr_log(GPR_ERROR, "Stream compression failed.");
+                  }
                   grpc_stream_compression_context_destroy(
                   grpc_stream_compression_context_destroy(
                       s->stream_compression_ctx);
                       s->stream_compression_ctx);
                   s->stream_compression_ctx = NULL;
                   s->stream_compression_ctx = NULL;