mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02: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:
parent
7f62be1bcd
commit
577ebeaefb
7 changed files with 185 additions and 113 deletions
41
src/libstore/ssh.hh
Normal file
41
src/libstore/ssh.hh
Normal file
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
#include "util.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
class SSHMaster
|
||||
{
|
||||
private:
|
||||
|
||||
std::string host;
|
||||
std::string keyFile;
|
||||
bool useMaster;
|
||||
bool compress;
|
||||
Pid sshMaster;
|
||||
std::unique_ptr<AutoDelete> tmpDir;
|
||||
Path socketPath;
|
||||
|
||||
public:
|
||||
|
||||
SSHMaster(const std::string & host, const std::string & keyFile, bool useMaster, bool compress)
|
||||
: host(host)
|
||||
, keyFile(keyFile)
|
||||
, useMaster(useMaster)
|
||||
, compress(compress)
|
||||
{
|
||||
}
|
||||
|
||||
struct Connection
|
||||
{
|
||||
Pid sshPid;
|
||||
AutoCloseFD out, in;
|
||||
};
|
||||
|
||||
std::unique_ptr<Connection> startCommand(const std::string & command);
|
||||
|
||||
void startMaster();
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue