From a618a8c6203d4cf57f12873a86797b8685b11e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 1 Dec 2020 15:55:57 +0100 Subject: daemon: Factorize substituter agent spawning. * nix/libstore/local-store.hh (class LocalStore)[substituter]: New method. [runningSubstituter]: Turn into a shared_ptr. * nix/libstore/local-store.cc (LocalStore::querySubstitutablePaths): Call 'substituter' instead of using inline code. (LocalStore::querySubstitutablePathInfos): Likewise. (LocalStore::substituter): New method. --- nix/libstore/local-store.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nix/libstore/local-store.hh') diff --git a/nix/libstore/local-store.hh b/nix/libstore/local-store.hh index 57d15bac7e..9ba37219da 100644 --- a/nix/libstore/local-store.hh +++ b/nix/libstore/local-store.hh @@ -42,7 +42,10 @@ class LocalStore : public StoreAPI { private: /* The currently running substituter or empty. */ - std::unique_ptr runningSubstituter; + std::shared_ptr runningSubstituter; + + /* Ensure the substituter is running and return it. */ + std::shared_ptr substituter(); Path linksDir; -- cgit v1.2.3