9ae3a8
From a56b8ac0a5917f0a2d007a9249a4ea299fc5c208 Mon Sep 17 00:00:00 2001
9ae3a8
From: "Daniel P. Berrange" <berrange@redhat.com>
9ae3a8
Date: Thu, 8 Feb 2018 17:50:29 +0100
9ae3a8
Subject: [PATCH 15/27] ui: move disconnecting check to start of
9ae3a8
 vnc_update_client
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Daniel P. Berrange <berrange@redhat.com>
9ae3a8
Message-id: <20180208175041.5634-16-berrange@redhat.com>
9ae3a8
Patchwork-id: 78937
9ae3a8
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 15/27] ui: move disconnecting check to start of vnc_update_client
9ae3a8
Bugzilla: 1527405
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
This is superficially similar to the combination of
9ae3a8
9ae3a8
  commit 5a8be0f73d6f60ff08746377eb09ca459f39deab
9ae3a8
  Author: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
  Date:   Wed Jul 13 12:21:20 2016 +0200
9ae3a8
9ae3a8
    vnc: make sure we finish disconnect
9ae3a8
9ae3a8
and
9ae3a8
9ae3a8
  commit c53df961617736f94731d94b62c2954c261d2bae
9ae3a8
  Author: Daniel P. Berrange <berrange@redhat.com>
9ae3a8
  Date:   Mon Dec 18 19:12:17 2017 +0000
9ae3a8
9ae3a8
      ui: remove unreachable code in vnc_update_client
9ae3a8
9ae3a8
We can't cherry-pick those changes, however, because they depend
9ae3a8
on the QIOChannel conversion. Thus, this downstream only change
9ae3a8
is done to make other following changes apply with fewer conflicts
9ae3a8
during backport.
9ae3a8
9ae3a8
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 ui/vnc.c | 10 ++++++----
9ae3a8
 1 file changed, 6 insertions(+), 4 deletions(-)
9ae3a8
9ae3a8
diff --git a/ui/vnc.c b/ui/vnc.c
9ae3a8
index ec7bb0c..874900c 100644
9ae3a8
--- a/ui/vnc.c
9ae3a8
+++ b/ui/vnc.c
9ae3a8
@@ -848,8 +848,13 @@ static int find_and_clear_dirty_height(struct VncState *vs,
9ae3a8
 
9ae3a8
 static int vnc_update_client(VncState *vs, int has_dirty)
9ae3a8
 {
9ae3a8
+    if (vs->csock == -1) {
9ae3a8
+        vnc_disconnect_finish(vs);
9ae3a8
+        return 0;
9ae3a8
+    }
9ae3a8
+
9ae3a8
     vs->has_dirty += has_dirty;
9ae3a8
-    if (vs->need_update && vs->csock != -1) {
9ae3a8
+    if (vs->need_update) {
9ae3a8
         VncDisplay *vd = vs->vd;
9ae3a8
         VncJob *job;
9ae3a8
         int y;
9ae3a8
@@ -904,9 +909,6 @@ static int vnc_update_client(VncState *vs, int has_dirty)
9ae3a8
         return n;
9ae3a8
     }
9ae3a8
 
9ae3a8
-    if (vs->csock == -1)
9ae3a8
-        vnc_disconnect_finish(vs);
9ae3a8
-
9ae3a8
     return 0;
9ae3a8
 }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8