Skip to content

Commit

Permalink
Merge pull request #1324 from obsidiansystems/serve-proto-build-optio…
Browse files Browse the repository at this point in the history
…ns-serializer

Use `ServeProto::Serialise<ServeProto::BuildOptions>`
  • Loading branch information
Ericson2314 authored Dec 11, 2023
2 parents 8c10331 + 20f5a21 commit f3a760a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/hydra-queue-runner/build-remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ static std::pair<Path, AutoCloseFD> openLogFile(const std::string & logDir, cons
*/
static void handshake(Machine::Connection & conn, unsigned int repeats)
{
conn.to << SERVE_MAGIC_1 << 0x206;
constexpr ServeProto::Version our_version = 0x206;

conn.to << SERVE_MAGIC_1 << our_version;
conn.to.flush();

unsigned int magic = readInt(conn.from);
Expand All @@ -215,6 +217,9 @@ static void handshake(Machine::Connection & conn, unsigned int repeats)
throw Error("unsupported ‘nix-store --serve’ protocol version on ‘%1%’", conn.machine->sshName);
if (GET_PROTOCOL_MINOR(conn.remoteVersion) < 3 && repeats > 0)
throw Error("machine ‘%1%’ does not support repeating a build; please upgrade it to Nix 1.12", conn.machine->sshName);

// Do not attempt to speak a newer version of the protocol
conn.remoteVersion = std::min(conn.remoteVersion, our_version);
}

static BasicDerivation sendInputs(
Expand Down Expand Up @@ -288,14 +293,7 @@ static BuildResult performBuild(
{
conn.to << ServeProto::Command::BuildDerivation << localStore.printStorePath(drvPath);
writeDerivation(conn.to, localStore, drv);
conn.to << options.maxSilentTime << options.buildTimeout;
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 2)
conn.to << options.maxLogSize;
if (GET_PROTOCOL_MINOR(conn.remoteVersion) >= 3) {
conn.to
<< options.nrRepeats
<< options.enforceDeterminism;
}
ServeProto::write(localStore, conn, options);
conn.to.flush();

BuildResult result;
Expand Down

0 comments on commit f3a760a

Please sign in to comment.