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
This commit is contained in:
parent
a6ab3cf35f
commit
d7a92ed4a9
1 changed files with 2 additions and 2 deletions
|
@ -880,8 +880,6 @@ static void opServe(Strings opFlags, Strings opArgs)
|
||||||
FdSource in(STDIN_FILENO);
|
FdSource in(STDIN_FILENO);
|
||||||
FdSink out(STDOUT_FILENO);
|
FdSink out(STDOUT_FILENO);
|
||||||
|
|
||||||
MonitorFdHup monitor(in.fd);
|
|
||||||
|
|
||||||
/* Exchange the greeting. */
|
/* Exchange the greeting. */
|
||||||
unsigned int magic = readInt(in);
|
unsigned int magic = readInt(in);
|
||||||
if (magic != SERVE_MAGIC_1) throw Error("protocol mismatch");
|
if (magic != SERVE_MAGIC_1) throw Error("protocol mismatch");
|
||||||
|
@ -1002,6 +1000,7 @@ static void opServe(Strings opFlags, Strings opArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
case cmdBuildPaths: {
|
case cmdBuildPaths: {
|
||||||
|
|
||||||
/* Used by build-remote.pl. */
|
/* Used by build-remote.pl. */
|
||||||
if (!writeAllowed) throw Error("building paths is not allowed");
|
if (!writeAllowed) throw Error("building paths is not allowed");
|
||||||
PathSet paths = readStorePaths<PathSet>(in);
|
PathSet paths = readStorePaths<PathSet>(in);
|
||||||
|
@ -1016,6 +1015,7 @@ static void opServe(Strings opFlags, Strings opArgs)
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
try {
|
try {
|
||||||
|
MonitorFdHup monitor(in.fd);
|
||||||
store->buildPaths(paths);
|
store->buildPaths(paths);
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
printMsg(lvlError, format("error: %1%") % e.msg());
|
printMsg(lvlError, format("error: %1%") % e.msg());
|
||||||
|
|
Loading…
Reference in a new issue