aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/httpshared.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-16 15:52:28 +0200
committerStefan Boberg <[email protected]>2021-09-16 15:55:56 +0200
commitbba212f57958f7b554ad41d608e16df66f397db8 (patch)
treed8f73e5feded8ec5ddc42ba010aa898de8730418 /zenhttp/httpshared.cpp
parentclang-format fixes (diff)
downloadzen-bba212f57958f7b554ad41d608e16df66f397db8.tar.xz
zen-bba212f57958f7b554ad41d608e16df66f397db8.zip
Minor CbPackage serialization tweaks
Diffstat (limited to 'zenhttp/httpshared.cpp')
-rw-r--r--zenhttp/httpshared.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/zenhttp/httpshared.cpp b/zenhttp/httpshared.cpp
index 2dbf95959..b0c5493db 100644
--- a/zenhttp/httpshared.cpp
+++ b/zenhttp/httpshared.cpp
@@ -123,23 +123,22 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint
MemoryInStream InStream(Payload);
BinaryReader Reader(InStream);
- CbPackage Package;
-
CbPackageHeader Hdr;
Reader.Read(&Hdr, sizeof Hdr);
if (Hdr.HeaderMagic != kCbPkgMagic)
{
- // report error
- return {};
+ throw std::runtime_error("invalid CbPackage header magic");
}
- uint32_t ChunkCount = Hdr.AttachmentCount + 1;
+ const uint32_t ChunkCount = Hdr.AttachmentCount + 1;
std::unique_ptr<CbAttachmentEntry[]> AttachmentEntries{new CbAttachmentEntry[ChunkCount]};
Reader.Read(AttachmentEntries.get(), sizeof(CbAttachmentEntry) * ChunkCount);
+ CbPackage Package;
+
for (uint32_t i = 0; i < ChunkCount; ++i)
{
const CbAttachmentEntry& Entry = AttachmentEntries[i];