summaryrefslogtreecommitdiff
path: root/nix/nix-daemon/nix-daemon.cc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-01-15 15:13:07 +0100
committerLudovic Courtès <ludo@gnu.org>2017-01-15 15:43:22 +0100
commitdeac976d3d26c7b85b9c90efb424b0aa94f1027c (patch)
tree3987ac00a3277aa6df907e67fa88889c5b937ed0 /nix/nix-daemon/nix-daemon.cc
parent09cadc8e78858e2fc59ef34306b5672f3145b12a (diff)
daemon: Client settings no longer override daemon settings.
Fixes <http://bugs.gnu.org/20217>. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x161. * nix/nix-daemon/nix-daemon.cc (performOp): "build-max-jobs", "build-max-silent-time", and "build-cores" are no longer read upfront; instead, read them from the key/value list at the end. * nix/nix-daemon/guix-daemon.cc (main): Explicitly set 'settings.maxBuildJobs'. * guix/store.scm (%protocol-version): Bump to #x161. (set-build-options): #:max-build-jobs, #:max-silent-time, and #:build-cores now default to #f. Adjust handshake to new protocol. * tests/store.scm ("build-cores"): New test. * tests/guix-daemon.sh: Add test for default "build-cores" value.
Diffstat (limited to 'nix/nix-daemon/nix-daemon.cc')
-rw-r--r--nix/nix-daemon/nix-daemon.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 47b67d5863..79580ffb48 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -549,8 +549,12 @@ static void performOp(bool trusted, unsigned int clientVersion,
settings.keepGoing = readInt(from) != 0;
settings.set("build-fallback", readInt(from) ? "true" : "false");
verbosity = (Verbosity) readInt(from);
- settings.set("build-max-jobs", std::to_string(readInt(from)));
- settings.set("build-max-silent-time", std::to_string(readInt(from)));
+
+ if (GET_PROTOCOL_MINOR(clientVersion) < 0x61) {
+ settings.set("build-max-jobs", std::to_string(readInt(from)));
+ settings.set("build-max-silent-time", std::to_string(readInt(from)));
+ }
+
if (GET_PROTOCOL_MINOR(clientVersion) >= 2)
settings.useBuildHook = readInt(from) != 0;
if (GET_PROTOCOL_MINOR(clientVersion) >= 4) {
@@ -558,7 +562,8 @@ static void performOp(bool trusted, unsigned int clientVersion,
logType = (LogType) readInt(from);
settings.printBuildTrace = readInt(from) != 0;
}
- if (GET_PROTOCOL_MINOR(clientVersion) >= 6)
+ if (GET_PROTOCOL_MINOR(clientVersion) >= 6
+ && GET_PROTOCOL_MINOR(clientVersion) < 0x61)
settings.set("build-cores", std::to_string(readInt(from)));
if (GET_PROTOCOL_MINOR(clientVersion) >= 10)
settings.set("build-use-substitutes", readInt(from) ? "true" : "false");
@@ -567,7 +572,10 @@ static void performOp(bool trusted, unsigned int clientVersion,
for (unsigned int i = 0; i < n; i++) {
string name = readString(from);
string value = readString(from);
- if (name == "build-timeout" || name == "build-repeat" || name == "use-ssh-substituter")
+ if (name == "build-timeout" || name == "build-max-silent-time"
+ || name == "build-max-jobs" || name == "build-cores"
+ || name == "build-repeat"
+ || name == "use-ssh-substituter")
settings.set(name, value);
else
settings.set(trusted ? name : "untrusted-" + name, value);