about summary refs log tree commit diff
path: root/src/nix-store/nix-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-24T09·52+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-07-24T09·59+0200
commitd7a92ed4a9faf8237322166656a2639d787cdeec (patch)
tree5dee490d53557c7646d522e71b3b0fe6cd7af7b8 /src/nix-store/nix-store.cc
parenta6ab3cf35f379e28d59bce7c235d10381256e13a (diff)
nix-store --serve: Only monitor stdin during builds
Other operations cannot hang indefinitely (except when we're reading
from stdin, in which case we'll notice a client disconnect). But
monitoring works badly during compressed imports, since there the
client can close the connection before we've sent an ack.

http://hydra.nixos.org/build/12711638
Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r--src/nix-store/nix-store.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 25a955e09363..42012f2e73ab 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -880,8 +880,6 @@ static void opServe(Strings opFlags, Strings opArgs)
     FdSource in(STDIN_FILENO);
     FdSink out(STDOUT_FILENO);
 
-    MonitorFdHup monitor(in.fd);
-
     /* Exchange the greeting. */
     unsigned int magic = readInt(in);
     if (magic != SERVE_MAGIC_1) throw Error("protocol mismatch");
@@ -1002,6 +1000,7 @@ static void opServe(Strings opFlags, Strings opArgs)
             }
 
             case cmdBuildPaths: {
+
                 /* Used by build-remote.pl. */
                 if (!writeAllowed) throw Error("building paths is not allowed");
                 PathSet paths = readStorePaths<PathSet>(in);
@@ -1016,6 +1015,7 @@ static void opServe(Strings opFlags, Strings opArgs)
 
                 int res = 0;
                 try {
+                    MonitorFdHup monitor(in.fd);
                     store->buildPaths(paths);
                 } catch (Error & e) {
                     printMsg(lvlError, format("error: %1%") % e.msg());