1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 23:42:43 +01:00

Improve SSH handling

* Unify SSH code in SSHStore and LegacySSHStore.

* Fix a race starting the SSH master. We now wait synchronously for
  the SSH master to finish starting. This prevents the SSH clients
  from starting their own connections.

* Don't use a master if max-connections == 1.

* Add a "max-connections" store parameter.

* Add a "compress" store parameter.
This commit is contained in:
Eelco Dolstra 2017-03-03 19:05:50 +01:00
parent 7f62be1bcd
commit 577ebeaefb
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
7 changed files with 185 additions and 113 deletions

View file

@ -40,10 +40,10 @@ template PathSet readStorePaths(Store & store, Source & from);
template Paths readStorePaths(Store & store, Source & from);
/* TODO: Separate these store impls into different files, give them better names */
RemoteStore::RemoteStore(const Params & params, size_t maxConnections)
RemoteStore::RemoteStore(const Params & params)
: Store(params)
, connections(make_ref<Pool<Connection>>(
maxConnections,
std::max(1, std::stoi(get(params, "max-connections", "1"))),
[this]() { return openConnection(); },
[](const ref<Connection> & r) { return r->to.good() && r->from.good(); }
))
@ -51,10 +51,10 @@ RemoteStore::RemoteStore(const Params & params, size_t maxConnections)
}
UDSRemoteStore::UDSRemoteStore(const Params & params, size_t maxConnections)
UDSRemoteStore::UDSRemoteStore(const Params & params)
: Store(params)
, LocalFSStore(params)
, RemoteStore(params, maxConnections)
, RemoteStore(params)
{
}
@ -129,7 +129,7 @@ void RemoteStore::initConnection(Connection & conn)
conn.processStderr();
}
catch (Error & e) {
throw Error(format("cannot start daemon worker: %1%") % e.msg());
throw Error("cannot open connection to remote store %s: %s", getUri(), e.what());
}
setOptions(conn);