Skip to content

Commit a507a0b

Browse files
committed
vmside: fix waiting for gui-daemon
libvchan_is_open() on server side before client got connected returns VCHAN_WAITING (2), so check for this value instead of 0. Fortunately, libvchan_read called later do wait for client connection if needed, so it was working by a coincidence. Also, don't try to reconnect when that initial waiting (or one of first vchan reads/writes). Reconnection logic assume that X server is already running, and generally gui-agent is fully initialized already, which isn't true in such a case. Theoretically this could be handled by resuming/restarting initialization procedure, but such a change is too big at this stage of Qubes 4.0 development. (cherry picked from commit 063e14f)
1 parent 93efd48 commit a507a0b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

gui-agent/vmside.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -1924,11 +1924,16 @@ void handle_guid_disconnect()
19241924
Ghandles *g = ghandles_for_vchan_reinitialize;
19251925
struct msg_xconf xconf;
19261926

1927+
if (!ghandles_for_vchan_reinitialize) {
1928+
fprintf(stderr, "gui-daemon disconnected before fully initialized, "
1929+
"cannot reconnect, exiting!\n");
1930+
exit(1);
1931+
}
19271932
libvchan_close(g->vchan);
19281933
wait_for_possible_dispvm_resume();
19291934
g->vchan = libvchan_server_init(0, 6000, 4096, 4096);
19301935
/* wait for gui daemon */
1931-
while (!libvchan_is_open(g->vchan))
1936+
while (libvchan_is_open(g->vchan) == VCHAN_WAITING)
19321937
libvchan_wait(g->vchan);
19331938
send_protocol_version(g->vchan);
19341939
/* discard */
@@ -1999,7 +2004,7 @@ int main(int argc, char **argv)
19992004
exit(1);
20002005
}
20012006
/* wait for gui daemon */
2002-
while (!libvchan_is_open(g.vchan))
2007+
while (libvchan_is_open(g.vchan) == VCHAN_WAITING)
20032008
libvchan_wait(g.vchan);
20042009
saved_argv = argv;
20052010
vchan_register_at_eof(handle_guid_disconnect);

0 commit comments

Comments
 (0)