1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 11:43:15 +02:00

Move ValidPathInfo serialization code to worker-protocol.{cc.hh}

It does not belong with the data type itself.

This also materializes the fact that `copyPath` does not do any version
negotiation just just hard-codes "16".

The non-standard interface of these serializers makes it harder to test,
but this is fixed in the next commit which then adds those tests.
This commit is contained in:
John Ericson 2022-03-08 23:09:26 +00:00
parent ab822af0df
commit 596bd469cc
7 changed files with 76 additions and 66 deletions

View file

@ -422,7 +422,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
}();
logger->stopWork();
pathInfo->write(to, *store, GET_PROTOCOL_MINOR(clientVersion));
WorkerProto::Serialise<ValidPathInfo>::write(*store, wconn, *pathInfo);
} else {
HashType hashAlgo;
std::string baseName;
@ -819,7 +819,7 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
if (info) {
if (GET_PROTOCOL_MINOR(clientVersion) >= 17)
to << 1;
info->write(to, *store, GET_PROTOCOL_MINOR(clientVersion), false);
WorkerProto::Serialise<ValidPathInfo>::write(*store, wconn, *info, false);
} else {
assert(GET_PROTOCOL_MINOR(clientVersion) >= 17);
to << 0;