aboutsummaryrefslogtreecommitdiff
path: root/zenserver/cache/structuredcache.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2021-11-14 08:51:29 +0100
committerPer Larsson <[email protected]>2021-11-14 08:51:29 +0100
commitd65be761d6c0b7ef74e854862514de55db6a2722 (patch)
treef3b6300f8f1ca4307181dfdc82b2ef50bd58de3a /zenserver/cache/structuredcache.cpp
parentFixed bug in upstream jupiter endpoint. (diff)
downloadzen-d65be761d6c0b7ef74e854862514de55db6a2722.tar.xz
zen-d65be761d6c0b7ef74e854862514de55db6a2722.zip
Parse chunk ID from chunk request.
Diffstat (limited to 'zenserver/cache/structuredcache.cpp')
-rw-r--r--zenserver/cache/structuredcache.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp
index feb8efb2e..79d370740 100644
--- a/zenserver/cache/structuredcache.cpp
+++ b/zenserver/cache/structuredcache.cpp
@@ -1000,7 +1000,7 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
CbObjectView RequestObject = RequestView.AsObjectView();
CbObjectView KeyObject = RequestObject["Key"sv].AsObjectView();
const CacheKey Key = CacheKey::Create(KeyObject["Bucket"sv].AsString(), KeyObject["Hash"sv].AsHash());
- const IoHash ChunkId = IoHash::Zero;
+ const IoHash ChunkId = RequestObject["ChunkId"sv].AsHash();
const Oid PayloadId = RequestObject["PayloadId"sv].AsObjectId();
const uint64_t RawOffset = RequestObject["RawoffSet"sv].AsUInt64();
const uint64_t RawSize = RequestObject["RawSize"sv].AsUInt64();
@@ -1016,12 +1016,13 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
Chunks.resize(ChunkRequests.size());
- // Try to find the uncompressed raw hash from the payload ID.
+ // Unreal uses a 12 byte ID to address cache record payloads. When the uncompressed hash (ChunkId)
+ // is missing, load the cache record and try to find the raw hash from the payload ID.
{
const auto GetChunkIdFromPayloadId = [](CbObjectView Record, const Oid& PayloadId) -> IoHash {
- if (CbObjectView ValueObject = Record["Value"].AsObjectView())
+ if (CbObjectView ValueObject = Record["Value"sv].AsObjectView())
{
- const Oid Id = ValueObject["Id"].AsObjectId();
+ const Oid Id = ValueObject["Id"sv].AsObjectId();
if (Id == PayloadId)
{
return ValueObject["RawHash"sv].AsHash();
@@ -1031,7 +1032,7 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
for (CbFieldView AttachmentView : Record["Attachments"sv])
{
CbObjectView AttachmentObject = AttachmentView.AsObjectView();
- const Oid Id = AttachmentObject["Id"].AsObjectId();
+ const Oid Id = AttachmentObject["Id"sv].AsObjectId();
if (Id == PayloadId)
{
@@ -1049,6 +1050,11 @@ HttpStructuredCacheService::HandleRpcGetCachePayloads(zen::HttpServerRequest& Re
for (CacheChunkRequest& ChunkRequest : ChunkRequests)
{
+ if (ChunkRequest.ChunkId != IoHash::Zero)
+ {
+ continue;
+ }
+
if (ChunkRequest.Key != CurrentKey)
{
CurrentKey = ChunkRequest.Key;