aboutsummaryrefslogtreecommitdiff
path: root/zenutil/cache/cacherequests.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-03-14 14:36:18 +0100
committerGitHub <[email protected]>2023-03-14 06:36:18 -0700
commitfea4fa0095668e392aa3333450e93afc1784762b (patch)
treec80ffdf3824ba75ee9b7c312010cdb84c48aae46 /zenutil/cache/cacherequests.cpp
parentremoved catch2 (#241) (diff)
downloadzen-fea4fa0095668e392aa3333450e93afc1784762b.tar.xz
zen-fea4fa0095668e392aa3333450e93afc1784762b.zip
send payloads as duplicated handles (#240)
* send payloads as duplicated handles if requestor provides process id and allows local file references. * linux/macos fixes * tests * fix access rights when duplicating handle * fix closing of duplicated handles on error * cleanup * changelog
Diffstat (limited to 'zenutil/cache/cacherequests.cpp')
-rw-r--r--zenutil/cache/cacherequests.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/zenutil/cache/cacherequests.cpp b/zenutil/cache/cacherequests.cpp
index 5cbb2e04b..4c865ec22 100644
--- a/zenutil/cache/cacherequests.cpp
+++ b/zenutil/cache/cacherequests.cpp
@@ -332,7 +332,9 @@ namespace cacherequests {
bool GetCacheRecordsRequest::Parse(const CbObjectView& RpcRequest)
{
ZEN_ASSERT(RpcRequest["Method"].AsString() == "GetCacheRecords");
- AcceptMagic = RpcRequest["AcceptType"].AsUInt32(0);
+ AcceptMagic = RpcRequest["AcceptType"].AsUInt32(0);
+ AcceptOptions = RpcRequest["AcceptFlags"].AsUInt16(0);
+ ProcessPid = RpcRequest["Pid"].AsInt32(0);
CbObjectView Params = RpcRequest["Params"].AsObjectView();
std::optional<std::string> RequestNamespace = GetRequestNamespace(Params);
@@ -373,6 +375,14 @@ namespace cacherequests {
{
Writer << "Accept" << AcceptMagic;
}
+ if (AcceptOptions != 0)
+ {
+ Writer << "AcceptFlags" << AcceptOptions;
+ }
+ if (ProcessPid != 0)
+ {
+ Writer << "Pid" << ProcessPid;
+ }
Writer.BeginObject("Params");
{
@@ -656,7 +666,9 @@ namespace cacherequests {
bool GetCacheValuesRequest::Parse(const CbObjectView& BatchObject)
{
ZEN_ASSERT(BatchObject["Method"].AsString() == "GetCacheValues");
- AcceptMagic = BatchObject["AcceptType"].AsUInt32(0);
+ AcceptMagic = BatchObject["AcceptType"].AsUInt32(0);
+ AcceptOptions = BatchObject["AcceptFlags"].AsUInt16(0);
+ ProcessPid = BatchObject["Pid"].AsInt32(0);
CbObjectView Params = BatchObject["Params"].AsObjectView();
std::optional<std::string> RequestNamespace = cacherequests::GetRequestNamespace(Params);
@@ -696,6 +708,14 @@ namespace cacherequests {
{
Writer << "Accept" << AcceptMagic;
}
+ if (AcceptOptions != 0)
+ {
+ Writer << "AcceptFlags" << AcceptOptions;
+ }
+ if (ProcessPid != 0)
+ {
+ Writer << "Pid" << ProcessPid;
+ }
Writer.BeginObject("Params");
{
@@ -817,7 +837,9 @@ namespace cacherequests {
bool GetCacheChunksRequest::Parse(const CbObjectView& BatchObject)
{
ZEN_ASSERT(BatchObject["Method"].AsString() == "GetCacheChunks");
- AcceptMagic = BatchObject["AcceptType"].AsUInt32(0);
+ AcceptMagic = BatchObject["AcceptType"].AsUInt32(0);
+ AcceptOptions = BatchObject["AcceptFlags"].AsUInt16(0);
+ ProcessPid = BatchObject["Pid"].AsInt32(0);
CbObjectView Params = BatchObject["Params"].AsObjectView();
std::optional<std::string> RequestNamespace = cacherequests::GetRequestNamespace(Params);
@@ -862,6 +884,14 @@ namespace cacherequests {
{
Writer << "Accept" << AcceptMagic;
}
+ if (AcceptOptions != 0)
+ {
+ Writer << "AcceptFlags" << AcceptOptions;
+ }
+ if (ProcessPid != 0)
+ {
+ Writer << "Pid" << ProcessPid;
+ }
Writer.BeginObject("Params");
{