Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quic: multiple cleanups #34137

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
quic: fixup set_final_size
Ignore subsequent calls to set_final_size unless the new size
is more than the previous, in which case, we have us a bug.
  • Loading branch information
jasnell committed Jun 30, 2020
commit f3ead5d94cd90b34bdad0ba8780104cdde021f7a
7 changes: 6 additions & 1 deletion src/quic/node_quic_stream-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ void QuicStream::set_flag(int32_t flag, bool on) {
}

void QuicStream::set_final_size(uint64_t final_size) {
CHECK_EQ(GetStat(&QuicStreamStats::final_size), 0);
// Only set the final size once.
if (is_flag_set(QUICSTREAM_FLAG_FIN)) {
CHECK_LE(final_size, GetStat(&QuicStreamStats::final_size));
return;
}
set_flag(QUICSTREAM_FLAG_FIN);
SetStat(&QuicStreamStats::final_size, final_size);
}

Expand Down
1 change: 0 additions & 1 deletion src/quic/node_quic_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ void QuicStream::ReceiveData(
// When fin != 0, we've received that last chunk of data for this
// stream, indicating that the stream will no longer be readable.
if (flags & NGTCP2_STREAM_DATA_FLAG_FIN) {
set_flag(QUICSTREAM_FLAG_FIN);
set_final_size(offset + datalen);
EmitRead(UV_EOF);
}
Expand Down
6 changes: 5 additions & 1 deletion src/quic/node_quic_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ class QuicStream : public AsyncWrap,
// Specifies the kind of headers currently being processed.
inline void set_headers_kind(QuicStreamHeadersKind kind);

// Set the final size for the QuicStream
// Set the final size for the QuicStream. This only works
// the first time it is called. Subsequent calls will be
// ignored unless the subsequent size is greater than the
// prior set size, in which case we have a bug and we'll
// assert.
inline void set_final_size(uint64_t final_size);

// The final size is the maximum amount of data that has been
Expand Down