Commit 809d9f22 authored by Daniel Berrange's avatar Daniel Berrange 💬

virt-viewer: ensure we close when seeing domain stop event

Normally virt-viewer relies on the VNC/SPICE widget seeing
an EOF on its underlying connection to detect when the
session is closed.

When tunnelling to a remote guest over SSH though, this
EOF can be delayed for a very long time, leaving a dead
session open.

This can be seen with

   virt-viewer -c qemu+ssh://remotehost/system guestname

when on the remote shell run

   virsh destroy guestname

and notice that virt-viewer does not see the shutdown

When we get a domain stopped event we know the session
should be dead, so forceably close it, if not already
Signed-off-by: Daniel Berrange's avatarDaniel P. Berrange <[email protected]>
(cherry picked from commit a62827d2)
parent 462d6de0
......@@ -577,6 +577,7 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
VirtViewer *self = opaque;
VirtViewerApp *app = VIRT_VIEWER_APP(self);
VirtViewerSession *session;
GError *error = NULL;
g_debug("Got domain event %d %d", event, detail);
......@@ -586,7 +587,9 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
switch (event) {
session = virt_viewer_app_get_session(app);
if (session != NULL)
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