diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-09-18T09·11+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-09-18T09·11+0000 |
commit | f3441e6122c3ce8f81576bfe79897a638c8f82e2 (patch) | |
tree | 59351c47a2090ab04dda61c24059e8b4c7f8497f /src/nix-worker | |
parent | 26f981c2e52bb8dc91311f9a4ca53f7e37233e5c (diff) |
* Pass various options to the worker so that flags like -K or -j work
in multi-user Nix (NIX-72). * Client/worker: exchange a protocol version number for future compatibility.
Diffstat (limited to 'src/nix-worker')
-rw-r--r-- | src/nix-worker/nix-worker.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index b9d5b1e26309..9f387a4ec130 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -414,6 +414,19 @@ static void performOp(Source & from, Sink & to, unsigned int op) break; } + + case wopSetOptions: { + keepFailed = readInt(from) != 0; + keepGoing = readInt(from) != 0; + tryFallback = readInt(from) != 0; + verbosity = (Verbosity) readInt(from); + maxBuildJobs = readInt(from); + maxSilentTime = readInt(from); + startWork(); + stopWork(); + break; + } + default: throw Error(format("invalid operation %1%") % op); @@ -437,14 +450,19 @@ static void processConnection() /* Exchange the greeting. */ unsigned int magic = readInt(from); if (magic != WORKER_MAGIC_1) throw Error("protocol mismatch"); - verbosity = (Verbosity) readInt(from); writeInt(WORKER_MAGIC_2, to); + writeInt(PROTOCOL_VERSION, to); + unsigned int clientVersion = readInt(from); + /* Send startup error messages to the client. */ startWork(); try { + /* If we can't accept clientVersion, then throw an error + *here* (not above). */ + /* Prevent users from doing something very dangerous. */ if (geteuid() == 0 && querySetting("build-users-group", "") == "") |