diff options
author | Dennis Oberst <[email protected]> | 2025-06-25 17:54:55 +0200 |
---|---|---|
committer | Dennis Oberst <[email protected]> | 2025-07-01 15:32:42 +0200 |
commit | 7bac7883b72e131b5bddd565fdab1bb83ded2a49 (patch) | |
tree | c65a396e6cbd6050bac059ffdc0d26650c8304a6 /src | |
parent | 6a4ef54cb760e35e9b5a331e7ff9161fef273033 (diff) |
Go up the chain and use the highest abstraction of the sendDATA
interfaces. Previously, we've been hit by internal QObject::deleteLater
calls for destroying the device in QtNetwork, which slowed down the
sending process. This has been fixed upstream, and all sendDATA
calls, except the QNCBD overload, now destroy the device immediately.
Reference: 4bc878ff4fbacd39d4c0ed1e8e742fd18fa74fed.
This version is now superior, as we don't have to create a new
connection just to destroy the device.
Pick-to: 6.10 6.9 6.8
Change-Id: I9416de25169fbaaa1657db7120987754699e4c00
Reviewed-by: Alexey Edelev <[email protected]>
Reviewed-by: MÃ¥rten Nordheim <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/grpc/qgrpchttp2channel.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/grpc/qgrpchttp2channel.cpp b/src/grpc/qgrpchttp2channel.cpp index 4cc1a000..4d9403a4 100644 --- a/src/grpc/qgrpchttp2channel.cpp +++ b/src/grpc/qgrpchttp2channel.cpp @@ -615,16 +615,9 @@ void Http2Handler::processQueue() if (m_queue.isEmpty()) return; - // Take ownership of the byte device. - auto *device = QNonContiguousByteDeviceFactory::create(m_queue.dequeue()); - device->setParent(m_stream); - - m_stream->sendDATA(device, device->atEnd() || m_endStreamAtFirstData); - // Manage the lifetime through the uploadFinished signal (or this - // Http2Handler). Don't use QObject::deleteLater here as this function is - // expensive and blocking. Delete the byte device directly. - // This is fine in this context. - connect(m_stream.get(), &QHttp2Stream::uploadFinished, device, [device] { delete device; }); + const auto nextMessage = m_queue.dequeue(); + const bool closeStream = nextMessage.isEmpty() || m_endStreamAtFirstData; + m_stream->sendDATA(nextMessage, closeStream); } bool Http2Handler::cancel() |