From 78224cd871e7ce9af628836995620abcb70e6935 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 23 Jul 2014 19:26:34 +0200 Subject: [PATCH] nix-store --serve: Monitor for client disconnects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/nix-store/nix-store.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 048f5c603..25a955e09 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 #include @@ -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");