From 8490ee37a6dbfb66e1b3dbaf88918bea044b143a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 3 Mar 2017 19:28:27 +0100 Subject: SSHMaster: Make thread-safe --- src/libstore/ssh.hh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/libstore/ssh.hh') diff --git a/src/libstore/ssh.hh b/src/libstore/ssh.hh index 2d2b98370396..72238dad79ab 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 tmpDir; - Path socketPath; + const std::string host; + const std::string keyFile; + const bool useMaster; + const bool compress; + + struct State + { + Pid sshMaster; + std::unique_ptr tmpDir; + Path socketPath; + }; + + Sync state_; public: @@ -34,8 +41,7 @@ public: std::unique_ptr startCommand(const std::string & command); - void startMaster(); - + Path startMaster(); }; } -- cgit 1.4.1