1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 02:11:15 +02:00

SSHMaster: Make thread-safe

This commit is contained in:
Eelco Dolstra 2017-03-03 19:28:27 +01:00
parent d3eb1cf3bb
commit 8490ee37a6
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 29 additions and 17 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include "util.hh"
#include "sync.hh"
namespace nix {
@ -8,13 +9,19 @@ class SSHMaster
{
private:
std::string host;
std::string keyFile;
bool useMaster;
bool compress;
Pid sshMaster;
std::unique_ptr<AutoDelete> tmpDir;
Path socketPath;
const std::string host;
const std::string keyFile;
const bool useMaster;
const bool compress;
struct State
{
Pid sshMaster;
std::unique_ptr<AutoDelete> tmpDir;
Path socketPath;
};
Sync<State> state_;
public:
@ -34,8 +41,7 @@ public:
std::unique_ptr<Connection> startCommand(const std::string & command);
void startMaster();
Path startMaster();
};
}