Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b327d33
n-api: add version to wasm registration
devsnek Jun 25, 2020
95eecd5
doc: improve paragraph in esm.md
Trott Jun 26, 2020
90d5f35
doc: make minor improvements to paragraph in child_process.md
Trott Jun 26, 2020
da8a1ef
zlib: remove redundant variable in zlibBufferOnEnd
puzpuzpuz Jun 26, 2020
9e135ac
wasi: add reactor support
devsnek Jun 25, 2020
c23d2fd
src: allow embedders to disable esm loader
codebytere Jun 26, 2020
cb673e1
2020-06-30, Version 12.18.2 'Erbium' (LTS)
BethGriggs Jun 26, 2020
b613933
test: update test-child-process-spawn-loop for Python 3
richardlau Jun 26, 2020
68634d2
quic: remove redundant cast
gengjiawen Jun 27, 2020
204f20f
quic: minor cleanups in quic_buffer
jasnell Jun 26, 2020
8f4b4f2
stream: destroy wrapped streams on error
ronag Jun 28, 2020
312a4f3
net: fix bufferSize
ronag Jun 27, 2020
0edeeec
net: doc deprecate bufferSize
ronag Jun 28, 2020
eb8fc2b
2020-06-30, Version 14.5.0 (Current)
codebytere Jun 28, 2020
e20beaf
meta: fixup CODEOWNERS so it hopefully works
jasnell Jul 1, 2020
73a51bb
quic: cleanups in JS API
jasnell Jun 27, 2020
d603418
quic: cleanups for QuicSocket
jasnell Jun 30, 2020
def8e76
quic: fixup set_final_size
jasnell Jun 30, 2020
3bae2d5
quic: consolidate onSessionClose and onSessionSilentClose
jasnell Jun 30, 2020
b1fab88
quic: remove unused callback function
jasnell Jun 30, 2020
2afc1ab
quic: fixup constant exports, export all protocol error codes
jasnell Jun 30, 2020
b5fe31e
quic: avoid using private JS fields for now
jasnell Jun 30, 2020
31d6d9d
quic: reduce duplication of code
jasnell Jun 30, 2020
584fc7e
doc: clarify ambiguous rdev description
Trott Jun 28, 2020
8ff8c68
doc: clarify O_EXCL text in fs.md
Trott Jun 28, 2020
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: minor cleanups in quic_buffer
PR-URL: #34087
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
  • Loading branch information
jasnell committed Jun 30, 2020
commit 204f20f2d1d5014e7f4fb2bf93a201995cc4914b
1 change: 0 additions & 1 deletion src/quic/node_quic_buffer-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ QuicBuffer::QuicBuffer(QuicBuffer&& src) noexcept
src.ended_ = false;
}


QuicBuffer& QuicBuffer::operator=(QuicBuffer&& src) noexcept {
if (this == &src) return *this;
this->~QuicBuffer();
Expand Down
13 changes: 10 additions & 3 deletions src/quic/node_quic_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ void QuicBufferChunk::MemoryInfo(MemoryTracker* tracker) const {

size_t QuicBuffer::Push(uv_buf_t* bufs, size_t nbufs, DoneCB done) {
size_t len = 0;
if (nbufs == 0 || bufs == nullptr || is_empty(bufs[0])) {
if (UNLIKELY(nbufs == 0)) {
done(0);
return 0;
}
DCHECK_NOT_NULL(bufs);
size_t n = 0;
while (nbufs > 1) {
if (!is_empty(bufs[n])) {
Expand All @@ -30,8 +31,14 @@ size_t QuicBuffer::Push(uv_buf_t* bufs, size_t nbufs, DoneCB done) {
n++;
nbufs--;
}
len += bufs[n].len;
Push(bufs[n], done);
if (!is_empty(bufs[n])) {
Push(bufs[n], done);
len += bufs[n].len;
}
// Special case if all the bufs were empty.
if (UNLIKELY(len == 0))
done(0);

return len;
}

Expand Down
12 changes: 6 additions & 6 deletions src/quic/node_quic_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using DoneCB = std::function<void(int)>;

// When data is sent over QUIC, we are required to retain it in memory
// until we receive an acknowledgement that it has been successfully
// acknowledged. The QuicBuffer object is what we use to handle that
// received. The QuicBuffer object is what we use to handle that
// and track until it is acknowledged. To understand the QuicBuffer
// object itself, it is important to understand how ngtcp2 and nghttp3
// handle data that is given to it to serialize into QUIC packets.
Expand Down Expand Up @@ -52,7 +52,7 @@ using DoneCB = std::function<void(int)>;
// QuicBuffer is further complicated by design quirks and limitations
// of the StreamBase API and how it interacts with the JavaScript side.
//
// QuicBuffer is essentially a linked list of QuicBufferChunk instances.
// QuicBuffer is a linked list of QuicBufferChunk instances.
// A single QuicBufferChunk wraps a single non-zero-length uv_buf_t.
// When the QuicBufferChunk is created, we capture the total length
// of the buffer and the total number of bytes remaining to be sent.
Expand All @@ -79,7 +79,7 @@ using DoneCB = std::function<void(int)>;
// along with a callback to be called when the data has
// been consumed.
//
// Any given chunk as a remaining-to-be-acknowledged length (length()) and a
// Any given chunk has a remaining-to-be-acknowledged length (length()) and a
// remaining-to-be-read-length (remaining()). The former tracks the number
// of bytes that have yet to be acknowledged by the QUIC peer. Once the
// remaining-to-be-acknowledged length reaches zero, the done callback
Expand All @@ -88,7 +88,7 @@ using DoneCB = std::function<void(int)>;
// serialized into QUIC packets and sent.
// The remaining-to-be-acknowledged length is adjusted using consume(),
// while the remaining-to-be-ead length is adjusted using seek().
class QuicBufferChunk : public MemoryRetainer {
class QuicBufferChunk final : public MemoryRetainer {
public:
// Default non-op done handler.
static void default_done(int status) {}
Expand Down Expand Up @@ -149,8 +149,8 @@ class QuicBufferChunk : public MemoryRetainer {
friend class QuicBuffer;
};

class QuicBuffer : public bob::SourceImpl<ngtcp2_vec>,
public MemoryRetainer {
class QuicBuffer final : public bob::SourceImpl<ngtcp2_vec>,
public MemoryRetainer {
public:
QuicBuffer() = default;

Expand Down