qrexec: periodically check if remote domain/process still exists

pull/1/head mm_e76007fe
Marek Marczykowski-Górecki 9 years ago
parent 9ea5790a9b
commit e76007fe20

@ -410,6 +410,7 @@ static void select_loop(libvchan_t *vchan)
int vchan_fd;
sigset_t selectmask;
struct timespec zero_timeout = { 0, 0 };
struct timespec select_timeout = { 10, 0 };
sigemptyset(&selectmask);
sigaddset(&selectmask, SIGCHLD);
@ -434,7 +435,7 @@ static void select_loop(libvchan_t *vchan)
&zero_timeout, &selectmask);
} else
ret = pselect(max_fd + 1, &select_set, NULL, NULL,
NULL, &selectmask);
&select_timeout, &selectmask);
if (ret < 0) {
if (errno == EINTR && local_pid > 0) {
continue;
@ -443,6 +444,12 @@ static void select_loop(libvchan_t *vchan)
do_exit(1);
}
}
if (ret == 0) {
if (!libvchan_is_open(vchan)) {
/* remote disconnected witout a proper signaling */
do_exit(1);
}
}
if (FD_ISSET(vchan_fd, &select_set))
libvchan_wait(vchan);
while (libvchan_data_ready(vchan))

Loading…
Cancel
Save