Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
quic: prevent multiple cancels
Browse files Browse the repository at this point in the history
PR-URL: #341
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
jasnell committed Feb 12, 2020
1 parent 2781829 commit 0ba4b5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/quic/node_quic_buffer-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ size_t QuicBuffer::Consume(size_t amount) {
}

size_t QuicBuffer::Cancel(int status) {
return Consume(status, length());
if (canceled_) return 0;
canceled_ = true;
size_t t = Consume(status, length());
return t;
}

void QuicBuffer::Push(uv_buf_t buf, DoneCB done) {
Expand Down
1 change: 1 addition & 0 deletions src/quic/node_quic_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class QuicBuffer : public bob::SourceImpl<ngtcp2_vec>,
QuicBufferChunk* head_ = nullptr; // Current Read Position
QuicBufferChunk* tail_ = nullptr; // Current Write Position

bool canceled_ = false;
bool ended_ = false;
size_t length_ = 0;
size_t remaining_ = 0;
Expand Down

0 comments on commit 0ba4b5d

Please sign in to comment.