diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 91e3d3018da..9bb826f3237 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -111,6 +111,9 @@ typedef struct { #define GRPC_ARG_MAX_CONCURRENT_STREAMS "grpc.max_concurrent_streams" /* Maximum message length that the channel can receive */ #define GRPC_ARG_MAX_MESSAGE_LENGTH "grpc.max_message_length" +/* Initial sequence number for http2 transports */ +#define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \ + "grpc.http2.initial_sequence_number" /* Result of a grpc call. If the caller satisfies the prerequisites of a particular operation, the grpc_call_error returned will be GRPC_CALL_OK. diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 0bee37c6142..10d4e9c30a7 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; + } } } }