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.
This commit is contained in:
parent
49fe9592a4
commit
78224cd871
1 changed files with 3 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
#include "serve-protocol.hh"
|
#include "serve-protocol.hh"
|
||||||
#include "worker-protocol.hh"
|
#include "worker-protocol.hh"
|
||||||
|
#include "monitor-fd.hh"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -879,6 +880,8 @@ 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");
|
||||||
|
|
Loading…
Reference in a new issue