From d3eb1cf3bbf57a33ac2e71a19a150c077011ecd9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Mar 2017 19:23:20 +0100 Subject: build-remote: Don't use a SSH master This is unnecessary because we make only one connection. --- src/build-remote/build-remote.cc | 4 +++- src/libstore/store-api.cc | 4 ++++ src/libstore/store-api.hh | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index fd710c2b6b71..3908dfac487d 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -233,7 +233,9 @@ int main (int argc, char * * argv) lock = -1; try { - sshStore = openStore("ssh://" + bestMachine->hostName + "?ssh-key=" + bestMachine->sshKey); + sshStore = openStore("ssh://" + bestMachine->hostName, + { {"ssh-key", bestMachine->sshKey }, + {"max-connections", "1" } }); hostName = bestMachine->hostName; } catch (std::exception & e) { printError("unable to open SSH connection to ā€˜%sā€™: %s; trying other available machines...", diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 401b001b2d8f..9c755965e45b 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -708,7 +708,11 @@ ref openStore(const std::string & uri_) } uri = uri_.substr(0, q); } + return openStore(uri, params); +} +ref openStore(const std::string & uri, const Store::Params & params) +{ for (auto fun : *RegisterStoreImplementation::implementations) { auto store = fun(uri, params); if (store) return ref(store); diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index c344b9d66ed3..481d0b799068 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -642,6 +642,8 @@ void removeTempRoots(); set to true *unless* you're going to collect garbage. */ ref openStore(const std::string & uri = getEnv("NIX_REMOTE")); +ref openStore(const std::string & uri, const Store::Params & params); + void copyPaths(ref from, ref to, const Paths & storePaths, bool substitute = false); -- cgit 1.4.1