aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-29 13:53:50 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-29 13:53:50 -0700
commit9557869e158d723ad7afd0b273fdcc414c036666 (patch)
tree15b9ee12245edd2fd7ec57a6ce01d16fd87892ec /src/core/ext/transport
parentad46ecfebabe79fe1941c54e8e7e46bb0e909fa3 (diff)
parent447bab1553d6b872e9cd447919f1b3a1e21c9ad6 (diff)
Merge branch 'optionalize_roundrobin' into optionalize_census
Diffstat (limited to 'src/core/ext/transport')
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.c38
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_table.c24
2 files changed, 42 insertions, 20 deletions
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.c b/src/core/ext/transport/chttp2/transport/hpack_parser.c
index 58e90f98f2..ec3387efb8 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.c
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.c
@@ -52,6 +52,8 @@
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/support/string.h"
+extern int grpc_http_trace;
+
typedef enum {
NOT_BINARY,
B64_BYTE0,
@@ -723,7 +725,9 @@ static int finish_indexed_field(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) {
grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
if (md == NULL) {
- gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
+ if (grpc_http_trace) {
+ gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
+ }
return 0;
}
GRPC_MDELEM_REF(md);
@@ -919,7 +923,9 @@ static int parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser *p,
/* finish parsing a max table size change */
static int finish_max_tbl_size(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) {
- gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
+ if (grpc_http_trace) {
+ gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
+ }
return grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index) &&
parse_begin(p, cur, end);
}
@@ -960,7 +966,9 @@ static int parse_error(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
static int parse_illegal_op(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
const uint8_t *end) {
GPR_ASSERT(cur != end);
- gpr_log(GPR_DEBUG, "Illegal hpack op code %d", *cur);
+ if (grpc_http_trace) {
+ gpr_log(GPR_DEBUG, "Illegal hpack op code %d", *cur);
+ }
return parse_error(p, cur, end);
}
@@ -1069,10 +1077,12 @@ static int parse_value4(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
}
error:
- gpr_log(GPR_ERROR,
- "integer overflow in hpack integer decoding: have 0x%08x, "
- "got byte 0x%02x on byte 5",
- *p->parsing.value, *cur);
+ if (grpc_http_trace) {
+ gpr_log(GPR_ERROR,
+ "integer overflow in hpack integer decoding: have 0x%08x, "
+ "got byte 0x%02x on byte 5",
+ *p->parsing.value, *cur);
+ }
return parse_error(p, cur, end);
}
@@ -1094,10 +1104,12 @@ static int parse_value5up(grpc_chttp2_hpack_parser *p, const uint8_t *cur,
return parse_next(p, cur + 1, end);
}
- gpr_log(GPR_ERROR,
- "integer overflow in hpack integer decoding: have 0x%08x, "
- "got byte 0x%02x sometime after byte 5",
- *p->parsing.value, *cur);
+ if (grpc_http_trace) {
+ gpr_log(GPR_ERROR,
+ "integer overflow in hpack integer decoding: have 0x%08x, "
+ "got byte 0x%02x sometime after byte 5",
+ *p->parsing.value, *cur);
+ }
return parse_error(p, cur, end);
}
@@ -1329,7 +1341,9 @@ static is_binary_header is_binary_literal_header(grpc_chttp2_hpack_parser *p) {
static is_binary_header is_binary_indexed_header(grpc_chttp2_hpack_parser *p) {
grpc_mdelem *elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
if (!elem) {
- gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
+ if (grpc_http_trace) {
+ gpr_log(GPR_ERROR, "Invalid HPACK index received: %d", p->index);
+ }
return ERROR_HEADER;
}
return grpc_is_binary_header(
diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.c b/src/core/ext/transport/chttp2/transport/hpack_table.c
index d02f4ddc61..67cd1bb10a 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_table.c
+++ b/src/core/ext/transport/chttp2/transport/hpack_table.c
@@ -41,6 +41,8 @@
#include "src/core/lib/support/murmur_hash.h"
+extern int grpc_http_trace;
+
static struct {
const char *key;
const char *value;
@@ -264,12 +266,16 @@ int grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl,
return 1;
}
if (bytes > tbl->max_bytes) {
- gpr_log(GPR_ERROR,
- "Attempt to make hpack table %d bytes when max is %d bytes", bytes,
- tbl->max_bytes);
+ if (grpc_http_trace) {
+ gpr_log(GPR_ERROR,
+ "Attempt to make hpack table %d bytes when max is %d bytes",
+ bytes, tbl->max_bytes);
+ }
return 0;
}
- gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes);
+ if (grpc_http_trace) {
+ gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes);
+ }
while (tbl->mem_used > bytes) {
evict1(tbl);
}
@@ -293,10 +299,12 @@ int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) {
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
if (tbl->current_table_bytes > tbl->max_bytes) {
- gpr_log(GPR_ERROR,
- "HPACK max table size reduced to %d but not reflected by hpack "
- "stream (still at %d)",
- tbl->max_bytes, tbl->current_table_bytes);
+ if (grpc_http_trace) {
+ gpr_log(GPR_ERROR,
+ "HPACK max table size reduced to %d but not reflected by hpack "
+ "stream (still at %d)",
+ tbl->max_bytes, tbl->current_table_bytes);
+ }
return 0;
}