diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-23T17·26+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-23T17·26+0200 |
commit | 78224cd871e7ce9af628836995620abcb70e6935 (patch) | |
tree | b7a48fcf7e4da0c3ee0a766cfce708f4a1886c98 /src/nix-store/nix-store.cc | |
parent | 49fe9592a47e7819179c2de4fd6068e897e944c7 (diff) |
nix-store --serve: Monitor for client disconnects
This is necessary because build-remote.pl now builds via ‘nix-store --serve’. So if a build hangs without writing to stdout/stderr, and the client disconnects, then we need to detect that.
Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r-- | src/nix-store/nix-store.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 048f5c603008..25a955e09363 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -8,6 +8,7 @@ #include "util.hh" #include "serve-protocol.hh" #include "worker-protocol.hh" +#include "monitor-fd.hh" #include <iostream> #include <algorithm> @@ -879,6 +880,8 @@ 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"); |