Commit 11c00080 authored by Nils Goroll's avatar Nils Goroll Committed by Lasse Karstensen

invalidate the cli_fd of dead varnishds

In particular, this avoids a later backend.list attempt on a file descriptor
to a dead process and, consequently, avoids a long delay in varnishtest
when varnishd cant be started (for instance, because it is not in PATH).
parent a8d3f1d2
......@@ -466,18 +466,26 @@ varnish_launch(struct varnish *v)
i, fd[0].revents, fd[1].revents);
if (i == 0) {
vtc_log(v->vl, 0, "FAIL timeout waiting for CLI connection");
AZ(close(v->cli_fd));
v->cli_fd = -1;
return;
}
if (fd[1].revents & POLLHUP) {
vtc_log(v->vl, 0, "FAIL debug pipe closed");
AZ(close(v->cli_fd));
v->cli_fd = -1;
return;
}
if (!(fd[0].revents & POLLIN)) {
vtc_log(v->vl, 0, "FAIL CLI connection wait failure");
AZ(close(v->cli_fd));
v->cli_fd = -1;
return;
}
nfd = accept(v->cli_fd, NULL, NULL);
if (nfd < 0) {
AZ(close(v->cli_fd));
v->cli_fd = -1;
vtc_log(v->vl, 0, "FAIL no CLI connection accepted");
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment