From fb79071e16ef2b3f070d92eba32069efcc6b1ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 13 Jun 2024 16:28:14 +0200 Subject: [PATCH] QHttp2Connection: add take- and clearDownloadBuffer Instead of retaining the data in the buffer forever. The downloadBuffer function was only added because there may be data received before there is a chance to connect to the signal. But then there is no reason to keep it there forever. Removing the downloadBuffer() function might be an idea at some point in preference of using these. Change-Id: I0b66676c8827570c5a25de2a28617880ccd9cf18 Reviewed-by: Timur Pocheptsov (cherry picked from commit ff26a209eaac9a9013a0cc41185a38d448af97e2) Reviewed-by: Qt Cherry-pick Bot --- src/network/access/qhttp2connection_p.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/network/access/qhttp2connection_p.h b/src/network/access/qhttp2connection_p.h index ca2cae58e04..e524c791a9c 100644 --- a/src/network/access/qhttp2connection_p.h +++ b/src/network/access/qhttp2connection_p.h @@ -114,6 +114,8 @@ public: HPack::HttpHeader receivedHeaders() const noexcept { return m_headers; } QByteDataBuffer downloadBuffer() const noexcept { return m_downloadBuffer; } + QByteDataBuffer takeDownloadBuffer() noexcept { return std::exchange(m_downloadBuffer, {}); } + void clearDownloadBuffer() { m_downloadBuffer.clear(); } Q_SIGNALS: void headersReceived(const HPack::HttpHeader &headers, bool endStream);