Github user bryancall commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/632#discussion_r63251327 --- Diff: proxy/http2/Http2ConnectionState.cc --- @@ -238,22 +241,29 @@ rcv_headers_frame(Http2ConnectionState &cstate, const Http2Frame &frame) header_block_fragment_length -= (HTTP2_HEADERS_PADLEN_LEN + params.pad_length); } - // NOTE: Parse priority parameters if exists - // TODO: Currently priority is NOT supported. TS-3535 will fix this. - if (frame.header().flags & HTTP2_FLAGS_HEADERS_PRIORITY) { - uint8_t buf[HTTP2_PRIORITY_LEN] = {0}; + if (new_stream) { + // NOTE: Parse priority parameters if exists + if (frame.header().flags & HTTP2_FLAGS_HEADERS_PRIORITY) { + uint8_t buf[HTTP2_PRIORITY_LEN] = {0}; - frame.reader()->memcpy(buf, HTTP2_PRIORITY_LEN, header_block_fragment_offset); - if (!http2_parse_priority_parameter(make_iovec(buf, HTTP2_PRIORITY_LEN), params.priority)) { - return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); - } - // Protocol error if the stream depends on itself - if (stream_id == params.priority.stream_dependency) { - return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); + frame.reader()->memcpy(buf, HTTP2_PRIORITY_LEN, header_block_fragment_offset); + if (!http2_parse_priority_parameter(make_iovec(buf, HTTP2_PRIORITY_LEN), params.priority)) { + return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); + } + // Protocol error if the stream depends on itself + if (stream_id == params.priority.stream_dependency) { + return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_PROTOCOL_ERROR); + } + + DebugHttp2Stream(cstate.ua_session, stream_id, "PRIORITY - dep: %d, weight: %d, excl: %d", params.priority.stream_dependency, + params.priority.weight, params.priority.exclusive_flag); + + header_block_fragment_offset += HTTP2_PRIORITY_LEN; + header_block_fragment_length -= HTTP2_PRIORITY_LEN; } - header_block_fragment_offset += HTTP2_PRIORITY_LEN; - header_block_fragment_length -= HTTP2_PRIORITY_LEN; + stream->node = cstate.dependency_tree->add(params.priority.stream_dependency, stream_id, params.priority.weight, --- End diff -- What about if the stream is new and we already received a priority frame. It looks like below you are adding the priority in the tree if the stream doesn't exist. My understanding is that we should be using the priority that is in the tree.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---