aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-05 15:41:51 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-05 15:41:51 +0100
commit022287060b04ec0af229de1c2a440625d8f9d94d (patch)
tree47e7232d4fb04fd3f0ee9ae46945062584a7a37b /src
parent750c993f004952685e3c06ffd222c6fe3b710c85 (diff)
parentdb88cb401ba07f0c2a4c0dca3e66fc33f2029e46 (diff)
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src')
-rw-r--r--src/libstore/download.cc3
-rw-r--r--src/libstore/ssh-store.cc6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index d8c52b151..8e0d7d42a 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -363,9 +363,10 @@ struct CurlDownloader : public Downloader
} else if (httpStatus == 401 || httpStatus == 403 || httpStatus == 407) {
// Don't retry on authentication/authorization failures
err = Forbidden;
- } else if (httpStatus >= 400 && httpStatus < 500 && httpStatus != 408) {
+ } else if (httpStatus >= 400 && httpStatus < 500 && httpStatus != 408 && httpStatus != 429) {
// Most 4xx errors are client errors and are probably not worth retrying:
// * 408 means the server timed out waiting for us, so we try again
+ // * 429 means too many requests, so we retry (with a delay)
err = Misc;
} else if (httpStatus == 501 || httpStatus == 505 || httpStatus == 511) {
// Let's treat most 5xx (server) errors as transient, except for a handful:
diff --git a/src/libstore/ssh-store.cc b/src/libstore/ssh-store.cc
index 42ee06501..af99ad40a 100644
--- a/src/libstore/ssh-store.cc
+++ b/src/libstore/ssh-store.cc
@@ -16,6 +16,8 @@ public:
const Setting<Path> sshKey{(Store*) this, "", "ssh-key", "path to an SSH private key"};
const Setting<bool> compress{(Store*) this, false, "compress", "whether to compress the connection"};
+ const Setting<Path> remoteProgram{this, "nix-daemon", "remote-program", "path to the nix-daemon executable on the remote system"};
+ const Setting<std::string> remoteStore{this, "", "remote-store", "URI of the store on the remote system"};
SSHStore(const std::string & host, const Params & params)
: Store(params)
@@ -82,7 +84,9 @@ ref<FSAccessor> SSHStore::getFSAccessor()
ref<RemoteStore::Connection> SSHStore::openConnection()
{
auto conn = make_ref<Connection>();
- conn->sshConn = master.startCommand("nix-daemon --stdio");
+ conn->sshConn = master.startCommand(
+ fmt("%s --stdio", remoteProgram)
+ + (remoteStore.get() == "" ? "" : " --store " + shellEscape(remoteStore.get())));
conn->to = FdSink(conn->sshConn->in.get());
conn->from = FdSource(conn->sshConn->out.get());
initConnection(*conn);