summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2016-07-12 10:27:09 (GMT)
committerDaniel P. Berrange <berrange@redhat.com>2016-07-12 12:54:15 (GMT)
commita62827d28c6b69e90102e4c1c8043cbddad8929a (patch)
treeef223b7a600c545f02ca0cccea31f8bbbed7f871
parent35e489d5190f7acd822240e777c43a2432fbad7b (diff)
downloadvirt-viewer-master.zip
virt-viewer-master.tar.gz
virt-viewer-master.tar.xz
virt-viewer: ensure we close when seeing domain stop eventHEADmaster
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 immediately. When we get a domain stopped event we know the session should be dead, so forceably close it, if not already closed. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--src/virt-viewer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 173b0d3..3a3b64d 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -664,6 +664,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);
@@ -673,7 +674,9 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
switch (event) {
case VIR_DOMAIN_EVENT_STOPPED:
- //virt_viewer_deactivate(self);
+ session = virt_viewer_app_get_session(app);
+ if (session != NULL)
+ virt_viewer_session_close(session);
break;
case VIR_DOMAIN_EVENT_STARTED: