qrexec: fix handling remote domain death

Periodically (every 10s) check if connection is still alive, otherwise
killing remote domain (as it's the case of DispVM) will hang client
side.

(cherry picked from commit 5f81f0486d)
This commit is contained in:
Marek Marczykowski-Górecki 2018-05-24 04:12:26 +02:00
parent 2ee80b9b83
commit d482add57d
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -295,6 +295,7 @@ int process_child_io(libvchan_t *data_vchan,
int remote_process_status = -1;
int ret, max_fd;
struct timespec zero_timeout = { 0, 0 };
struct timespec normal_timeout = { 10, 0 };
struct buffer stdin_buf;
sigemptyset(&selectmask);
@ -386,7 +387,7 @@ int process_child_io(libvchan_t *data_vchan,
/* check for other FDs, but exit immediately */
ret = pselect(max_fd + 1, &rdset, &wrset, NULL, &zero_timeout, &selectmask);
} else
ret = pselect(max_fd + 1, &rdset, &wrset, NULL, NULL, &selectmask);
ret = pselect(max_fd + 1, &rdset, &wrset, NULL, &normal_timeout, &selectmask);
if (ret < 0) {
if (errno == EINTR)
continue;