Skip to content

Commit

Permalink
quic: fix flaky assertion error
Browse files Browse the repository at this point in the history
PR-URL: nodejs#292
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
jasnell committed Feb 3, 2020
1 parent 44216d0 commit 86b2c14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/quic/node_quic_default_application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ int DefaultApplication::GetStreamData(StreamData* stream_data) {
}
};

CHECK_GE(stream->Pull(
std::move(next),
bob::Options::OPTIONS_SYNC,
stream_data->data,
arraysize(stream_data->data),
kMaxVectorCount), 0);
if (LIKELY(!stream->is_eos())) {
CHECK_GE(stream->Pull(
std::move(next),
bob::Options::OPTIONS_SYNC,
stream_data->data,
arraysize(stream_data->data),
kMaxVectorCount), 0);
}

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/quic/node_quic_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ int QuicStream::ReadStop() {
void QuicStream::IncrementStats(size_t datalen) {
uint64_t len = static_cast<uint64_t>(datalen);
IncrementStat(&QuicStreamStats::bytes_received, len);

RecordRate(&QuicStreamStats::received_at);
RecordSize(len);
}
Expand Down Expand Up @@ -318,6 +317,7 @@ void QuicStream::ReceiveData(
// on the stream when data transfer rates are likely to be considered too
// slow.
IncrementStats(datalen);

while (datalen > 0) {
uv_buf_t buf = EmitAlloc(datalen);
size_t avail = std::min(static_cast<size_t>(buf.len), datalen);
Expand Down

0 comments on commit 86b2c14

Please sign in to comment.