From 88025588951f968ae149b62e358fabd6c155d2f0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 4 May 2015 09:41:10 -0700 Subject: Add a hook to allow initial HTTP2 sequence number to be specified --- src/core/transport/chttp2_transport.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/core/transport/chttp2_transport.c') diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 0bee37c614..10d4e9c30a 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -524,6 +524,19 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, push_setting(t, GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, channel_args->args[i].value.integer); } + } else if (0 == strcmp(channel_args->args[i].key, + GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER)) { + if (channel_args->args[i].type != GRPC_ARG_INTEGER) { + gpr_log(GPR_ERROR, "%s: must be an integer", + GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER); + } else if ((t->next_stream_id & 1) != + (channel_args->args[i].value.integer & 1)) { + gpr_log(GPR_ERROR, "%s: low bit must be %d on %s", + GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER, t->next_stream_id & 1, + t->is_client ? "client" : "server"); + } else { + t->next_stream_id = channel_args->args[i].value.integer; + } } } } -- cgit v1.2.3 From 8fc673eefd853920946dcaff0613701247297f10 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 4 May 2015 09:48:43 -0700 Subject: Fix typo resulting in masking out high byte of http2 sequence numbers --- src/core/transport/chttp2_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/transport/chttp2_transport.c') diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 10d4e9c30a..4194d9f1bd 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1767,7 +1767,7 @@ static int process_read(transport *t, gpr_slice slice) { /* fallthrough */ case DTS_FH_5: GPR_ASSERT(cur < end); - t->incoming_stream_id = (((gpr_uint32)*cur) << 24) & 0x7f; + t->incoming_stream_id = (((gpr_uint32)*cur) & 0x7f) << 24; if (++cur == end) { t->deframe_state = DTS_FH_6; return 1; -- cgit v1.2.3