civodul pushed a commit to tag 1.8
in repository guix.
commit 78224cd871e7ce9af628836995620abcb70e6935
Author: Eelco Dolstra <[email protected]>
Date: Wed Jul 23 19:26:34 2014 +0200
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.
---
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 048f5c6..25a955e 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");