diff options
| author | Dan Engelbrecht <[email protected]> | 2022-09-29 09:25:29 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-29 00:25:29 -0700 |
| commit | f87631dd0d283ad04eb3873c1a7510a9d1423792 (patch) | |
| tree | fb6da8ce9b1e55beff73c82d8943dc0303c7ae05 /zenhttp/httpshared.cpp | |
| parent | De/more upstream details (#168) (diff) | |
| download | zen-f87631dd0d283ad04eb3873c1a7510a9d1423792.tar.xz zen-f87631dd0d283ad04eb3873c1a7510a9d1423792.zip | |
Format all rpc package responses using `FormatPackageMessageBuffer` to avoid memory copy (#174)
When reading upstream, fall back to old rpc response to handle older instances.
Diffstat (limited to 'zenhttp/httpshared.cpp')
| -rw-r--r-- | zenhttp/httpshared.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/zenhttp/httpshared.cpp b/zenhttp/httpshared.cpp index 769b5e3f3..2b96f32fc 100644 --- a/zenhttp/httpshared.cpp +++ b/zenhttp/httpshared.cpp @@ -339,6 +339,17 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint return Package; } +bool +ParsePackageMessageWithLegacyFallback(const IoBuffer& Response, CbPackage& OutPackage) +{ + if (IsPackageMessage(Response)) + { + OutPackage = ParsePackageMessage(Response); + return true; + } + return OutPackage.TryLoad(Response); +} + CbPackageReader::CbPackageReader() : m_CreateBuffer([](const IoHash&, uint64_t Size) -> IoBuffer { return IoBuffer{Size}; }) { } |