diff --git a/src/quic/node_quic_session.cc b/src/quic/node_quic_session.cc index ba8bd0fb187f15..9b74f03b0cc635 100644 --- a/src/quic/node_quic_session.cc +++ b/src/quic/node_quic_session.cc @@ -3608,8 +3608,9 @@ void QuicSession::OnQlogWrite( std::vector buffer(len); memcpy(buffer.data(), data, len); env->SetImmediate([ptr = std::move(ptr), - buffer = std::move(buffer)](Environment*) { - ptr->Emit(buffer.data(), buffer.size()); + buffer = std::move(buffer), + flags](Environment*) { + ptr->Emit(buffer.data(), buffer.size(), flags); }); } @@ -3647,7 +3648,7 @@ QLogStream::QLogStream(Environment* env, v8::Local obj) StreamBase::AttachToObject(GetObject()); } -void QLogStream::Emit(const uint8_t* data, size_t len) { +void QLogStream::Emit(const uint8_t* data, size_t len, uint32_t flags) { size_t remaining = len; while (remaining != 0) { uv_buf_t buf = EmitAlloc(len); @@ -3658,10 +3659,7 @@ void QLogStream::Emit(const uint8_t* data, size_t len) { EmitRead(avail, buf); } - // The last chunk that ngtcp2 writes is 6 bytes. Unfortunately, - // this is the only way for us to know that ngtcp2 is definitely - // done sending qlog events. - if (ended_ && len == 6) + if (ended_ && flags & NGTCP2_QLOG_WRITE_FLAG_FIN) EmitRead(UV_EOF); } diff --git a/src/quic/node_quic_session.h b/src/quic/node_quic_session.h index fc09eab84584f4..7c9b3f9710f17b 100644 --- a/src/quic/node_quic_session.h +++ b/src/quic/node_quic_session.h @@ -238,7 +238,7 @@ class QLogStream final : public AsyncWrap, QLogStream(Environment* env, v8::Local obj); - void Emit(const uint8_t* data, size_t len); + void Emit(const uint8_t* data, size_t len, uint32_t flags); void End() { ended_ = true; }