mirror of
https://github.com/NixOS/nix.git
synced 2025-11-13 22:12:43 +01:00
* 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.
This commit is contained in:
parent
26f981c2e5
commit
f3441e6122
5 changed files with 49 additions and 7 deletions
|
|
@ -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", "") == "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue