diff options
| author | Dan Engelbrecht <[email protected]> | 2023-08-17 22:52:28 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-17 22:52:28 +0200 |
| commit | dc320d6bfe81f149e8276caabcd165a931711ae7 (patch) | |
| tree | 4fd245d817876f15e90eb30f6577d4550c76f8fc /src/zenserver/cache/httpstructuredcache.cpp | |
| parent | single thread async cache log (#361) (diff) | |
| download | zen-dc320d6bfe81f149e8276caabcd165a931711ae7.tar.xz zen-dc320d6bfe81f149e8276caabcd165a931711ae7.zip | |
Cache process handles for FormatPackageMessage (#360)
Diffstat (limited to 'src/zenserver/cache/httpstructuredcache.cpp')
| -rw-r--r-- | src/zenserver/cache/httpstructuredcache.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index 51d3d94d8..9b7ec61d7 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -1652,7 +1652,8 @@ HttpStructuredCacheService::ReplayRequestRecorder(const CacheRequestContext& Co { if (AcceptMagic == kCbPkgMagic) { - FormatFlags Flags = FormatFlags::kDefault; + void* TargetProcessHandle = nullptr; + FormatFlags Flags = FormatFlags::kDefault; if (EnumHasAllFlags(AcceptFlags, RpcAcceptOptions::kAllowLocalReferences)) { Flags |= FormatFlags::kAllowLocalReferences; @@ -1660,8 +1661,9 @@ HttpStructuredCacheService::ReplayRequestRecorder(const CacheRequestContext& Co { Flags |= FormatFlags::kDenyPartialLocalReferences; } + TargetProcessHandle = m_OpenProcessCache.GetProcessHandle(Context.SessionId, TargetPid); } - CompositeBuffer RpcResponseBuffer = FormatPackageMessageBuffer(RpcResult, Flags, TargetPid); + CompositeBuffer RpcResponseBuffer = FormatPackageMessageBuffer(RpcResult, Flags, TargetProcessHandle); ZEN_ASSERT(RpcResponseBuffer.GetSize() > 0); } else @@ -1705,6 +1707,7 @@ HttpStructuredCacheService::HandleRpcRequest(HttpServerRequest& Request) Request.WriteResponseAsync( [this, RequestContext, Body = Request.ReadPayload(), ContentType, AcceptType](HttpServerRequest& AsyncRequest) mutable { + ZEN_TRACE_CPU("z$::Http::HandleRpcRequest::WriteResponseAsync"); std::uint64_t RequestIndex = m_RequestRecorder ? m_RequestRecorder->RecordRequest(ContentType, AcceptType, Body) : ~0ull; uint32_t AcceptMagic = 0; @@ -1726,7 +1729,8 @@ HttpStructuredCacheService::HandleRpcRequest(HttpServerRequest& Request) } if (AcceptMagic == kCbPkgMagic) { - FormatFlags Flags = FormatFlags::kDefault; + void* TargetProcessHandle = nullptr; + FormatFlags Flags = FormatFlags::kDefault; if (EnumHasAllFlags(AcceptFlags, RpcAcceptOptions::kAllowLocalReferences)) { Flags |= FormatFlags::kAllowLocalReferences; @@ -1734,8 +1738,9 @@ HttpStructuredCacheService::HandleRpcRequest(HttpServerRequest& Request) { Flags |= FormatFlags::kDenyPartialLocalReferences; } + TargetProcessHandle = m_OpenProcessCache.GetProcessHandle(RequestContext.SessionId, TargetProcessId); } - CompositeBuffer RpcResponseBuffer = FormatPackageMessageBuffer(RpcResult, Flags, TargetProcessId); + CompositeBuffer RpcResponseBuffer = FormatPackageMessageBuffer(RpcResult, Flags, TargetProcessHandle); if (RequestIndex != ~0ull) { ZEN_ASSERT(m_RequestRecorder); @@ -2400,9 +2405,11 @@ HttpStructuredCacheService::HandleRpcGetCacheValues(const CacheRequestContext& C std::vector<size_t> RemoteRequestIndexes; - const bool HasUpstream = m_UpstreamCache.IsActive(); + const bool HasUpstream = m_UpstreamCache.IsActive(); + CbArrayView RequestView = Params["Requests"sv].AsArrayView(); + Requests.reserve(RequestView.Num()); - for (CbFieldView RequestField : Params["Requests"sv]) + for (CbFieldView RequestField : RequestView) { Stopwatch Timer; |