Skip to content

Commit 2e698ad

Browse files
committed
maybe fixes
1 parent 277002c commit 2e698ad

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/core/ext/transport/chttp2/transport/hpack_parser.cc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ void HPackParser::QueueBufferToParse(const grpc_slice& slice) {
15591559
queued_slices_.push_back(grpc_slice_ref_internal(slice));
15601560
}
15611561

1562-
grpc_error_handle HPackParser::FinishFrame() {
1562+
grpc_error_handle HPackParser::Parse() {
15631563
grpc_error_handle error = GRPC_ERROR_NONE;
15641564
for (const auto& slice : queued_slices_) {
15651565
error = Parse(slice);
@@ -1569,11 +1569,12 @@ grpc_error_handle HPackParser::FinishFrame() {
15691569
grpc_slice_unref_internal(slice);
15701570
}
15711571
queued_slices_.clear();
1572+
return error;
1573+
}
15721574

1575+
void HPackParser::FinishFrame() {
15731576
sink_ = Sink();
15741577
dynamic_table_updates_allowed_ = 2;
1575-
1576-
return error;
15771578
}
15781579

15791580
grpc_error_handle HPackParser::Parse(const grpc_slice& slice) {
@@ -1645,12 +1646,14 @@ grpc_error_handle grpc_chttp2_header_parser_parse(void* hpack_parser,
16451646
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
16461647
}
16471648
parser->QueueBufferToParse(slice);
1648-
if (!is_last || !parser->is_boundary()) {
1649+
if (!is_last) {
16491650
return GRPC_ERROR_NONE;
16501651
}
1651-
grpc_error_handle error = parser->FinishFrame();
1652-
if (error != GRPC_ERROR_NONE) {
1653-
return error;
1652+
if (parser->is_boundary()) {
1653+
grpc_error_handle error = parser->Parse();
1654+
if (error != GRPC_ERROR_NONE) {
1655+
return error;
1656+
}
16541657
}
16551658
/* need to check for null stream: this can occur if we receive an invalid
16561659
stream id on a header */
@@ -1682,5 +1685,6 @@ grpc_error_handle grpc_chttp2_header_parser_parse(void* hpack_parser,
16821685
grpc_chttp2_mark_stream_closed(t, s, true, false, GRPC_ERROR_NONE);
16831686
}
16841687
}
1688+
parser->FinishFrame();
16851689
return GRPC_ERROR_NONE;
16861690
}

src/core/ext/transport/chttp2/transport/hpack_parser.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class HPackParser {
4646
void BeginFrame(Sink sink, Boundary boundary, Priority priority);
4747
void ResetSink(Sink sink) { sink_ = std::move(sink); }
4848
void QueueBufferToParse(const grpc_slice& slice);
49-
grpc_error_handle FinishFrame();
49+
grpc_error_handle Parse();
50+
void FinishFrame();
5051

5152
grpc_chttp2_hptbl* hpack_table() { return &table_; }
5253
bool is_boundary() const { return boundary_ != Boundary::None; }

0 commit comments

Comments
 (0)