aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/ssh.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-03-03 19:28:27 +0100
committerEelco Dolstra <edolstra@gmail.com>2017-03-03 19:28:27 +0100
commit8490ee37a6dbfb66e1b3dbaf88918bea044b143a (patch)
treef0a244e19a8b7412e93b1f487aa4c8d572ff19e4 /src/libstore/ssh.hh
parentd3eb1cf3bbf57a33ac2e71a19a150c077011ecd9 (diff)
SSHMaster: Make thread-safe
Diffstat (limited to 'src/libstore/ssh.hh')
-rw-r--r--src/libstore/ssh.hh24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/libstore/ssh.hh b/src/libstore/ssh.hh
index 2d2b98370..72238dad7 100644
--- a/src/libstore/ssh.hh
+++ b/src/libstore/ssh.hh
@@ -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();
};
}