hexa (signing key rotation when) | diff --cc src/hydra-queue-runner/build-remote.cc
index 1cabd291,b1629595..00000000
--- a/src/hydra-queue-runner/build-remote.cc
+++ b/src/hydra-queue-runner/build-remote.cc
@@@ -43,31 -48,63 +43,44 @@@ static Strings extraStoreArgs(std::stri
return result;
}
-static void openConnection(::Machine::ptr machine, Path tmpDir, int stderrFD, SSHMaster::Connection & child)
+static std::unique_ptr<SSHMaster::Connection> openConnection(
+ ::Machine::ptr machine, SSHMaster & master)
{
- std::string pgmName;
- Pipe to, from;
- to.create();
- from.create();
-
- Strings argv;
+ Strings command = {"nix-store", "--serve", "--write"};
if (machine->isLocalhost()) {
- pgmName = "nix-store";
- argv = {"nix-store", "--builders", "", "--serve", "--write"};
+ command.push_back("--builders");
+ command.push_back("");
} else {
- pgmName = "ssh";
- auto sshName = machine->sshName;
- Strings extraArgs = extraStoreArgs(sshName);
- argv = {"ssh", sshName};
- if (machine->sshKey != "") append(argv, {"-i", machine->sshKey});
- if (machine->sshPublicHostKey != "") {
- Path fileName = tmpDir + "/host-key";
- auto p = machine->sshName.find("@");
- std::string host = p != std::string::npos ? std::string(machine->sshName, p + 1) : machine->sshName;
- writeFile(fileName, host + " " + machine->sshPublicHostKey + "\n");
- append(argv, {"-oUserKnownHostsFile=" + fileName});
- }
- append(argv,
- { "-x", "-a", "-oBatchMode=yes", "-oConnectTimeout=60", "-oTCPKeepAlive=yes"
- , "--", "nix-store", "--serve", "--write" });
- append(argv, extraArgs);
+ command.splice(command.end(), extraStoreArgs(machine->sshName));
}
- child.sshPid = startProcess([&]() {
- restoreProcessContext();
-
- if (dup2(to.readSide.get(), STDIN_FILENO) == -1)
- throw SysError("cannot dup input pipe to stdin");
-
- if (dup2(from.writeSide.get(), STDOUT_FILENO) == -1)
- throw SysError("cannot dup output pipe to stdout");
+ auto ret = master.startCommand(std::move(command), {
+ "-a", "-oBatchMode=yes", "-oConnectTimeout=60", "-oTCPKeepAlive=yes"
+ });
- if (dup2(stderrFD, STDERR_FILENO) == -1)
- throw SysError("cannot dup stderr");
+ // XXX: determine the actual max value we can use from /proc.
- execvp(argv.front().c_str(), (char * *) stringsToCharPtrs(argv).data()); // FIXME: remove cast
++<<<<<<< HEAD
+ // FIXME: Should this be upstreamed into `startCommand` in Nix?
- throw SysError("cannot start %s", pgmName);
- });
+ int pipesize = 1024 * 1024;
- to.readSide = -1;
- from.writeSide = -1;
+ fcntl(ret->in.get(), F_SETPIPE_SZ, &pipesize);
+ fcntl(ret->out.get(), F_SETPIPE_SZ, &pipesize);
+ return ret;
++||||||| parent of 18466e83 (queue-runner: try larger pipe buffer sizes)
++ child.in = to.writeSide.release();
++ child.out = from.readSide.release();
++=======
+ child.in = to.writeSide.release();
+ child.out = from.readSide.release();
+
+ // XXX: determine the actual max value we can use from /proc.
+ int pipesize = 1024 * 1024;
+ fcntl(child.in.get(), F_SETPIPE_SZ, &pipesize);
+ fcntl(child.out.get(), F_SETPIPE_SZ, &pipesize);
++>>>>>>> 18466e83 (queue-runner: try larger pipe buffer sizes)
}
| 15:45:23 |