mirror of
https://github.com/NixOS/nix.git
synced 2025-11-17 07:52: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
|
|
@ -53,18 +53,24 @@ RemoteStore::RemoteStore()
|
|||
from.fd = fdSocket;
|
||||
to.fd = fdSocket;
|
||||
|
||||
|
||||
/* Send the magic greeting, check for the reply. */
|
||||
try {
|
||||
writeInt(WORKER_MAGIC_1, to);
|
||||
writeInt(verbosity, to);
|
||||
unsigned int magic = readInt(from);
|
||||
if (magic != WORKER_MAGIC_2) throw Error("protocol mismatch");
|
||||
|
||||
unsigned int daemonVersion = readInt(from);
|
||||
if (GET_PROTOCOL_MAJOR(daemonVersion) != GET_PROTOCOL_MAJOR(PROTOCOL_VERSION))
|
||||
throw Error("Nix daemon protocol version not supported");
|
||||
writeInt(PROTOCOL_VERSION, to);
|
||||
processStderr();
|
||||
|
||||
} catch (Error & e) {
|
||||
throw Error(format("cannot start worker (%1%)")
|
||||
% e.msg());
|
||||
}
|
||||
|
||||
setOptions();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -154,6 +160,19 @@ RemoteStore::~RemoteStore()
|
|||
}
|
||||
|
||||
|
||||
void RemoteStore::setOptions()
|
||||
{
|
||||
writeInt(wopSetOptions, to);
|
||||
writeInt(keepFailed, to);
|
||||
writeInt(keepGoing, to);
|
||||
writeInt(tryFallback, to);
|
||||
writeInt(verbosity, to);
|
||||
writeInt(maxBuildJobs, to);
|
||||
writeInt(maxSilentTime, to);
|
||||
processStderr();
|
||||
}
|
||||
|
||||
|
||||
bool RemoteStore::isValidPath(const Path & path)
|
||||
{
|
||||
writeInt(wopIsValidPath, to);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue