summaryrefslogtreecommitdiffstats
path: root/main/xen/qemu-xen-vnc-robustness.patch
blob: b06bcaf0aa463f43b75eef619cc69323f7b46660 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- xen-4.3.0.orig/tools/qemu-xen/ui/vnc.c
+++ xen-4.3.0/tools/qemu-xen/ui/vnc.c
@@ -2703,6 +2703,8 @@
 
     vs->csock = csock;
 
+    QTAILQ_INSERT_HEAD(&vd->clients, vs, next);
+
     if (skipauth) {
 	vs->auth = VNC_AUTH_NONE;
 #ifdef CONFIG_VNC_TLS
@@ -2739,17 +2741,11 @@
 
     vs->vd = vd;
 
-#ifdef CONFIG_VNC_WS
-    if (!vs->websocket)
-#endif
-    {
-        vnc_init_state(vs);
-    }
-}
+    if (vs->vd->lock_key_sync)
+        vs->led = qemu_add_led_event_handler(kbd_leds, vs);
 
-void vnc_init_state(VncState *vs)
-{
-    VncDisplay *vd = vs->vd;
+    vs->mouse_mode_notifier.notify = check_pointer_type_change;
+    qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
 
     vs->ds = vd->ds;
     vs->last_x = -1;
@@ -2763,21 +2759,26 @@
     qemu_mutex_init(&vs->output_mutex);
     vs->bh = qemu_bh_new(vnc_jobs_bh, vs);
 
-    QTAILQ_INSERT_HEAD(&vd->clients, vs, next);
+    vnc_init_timer(vd);
 
+#ifdef CONFIG_VNC_WS
+    if (!vs->websocket)
+#endif
+    {
+        vnc_init_state(vs);
+    }
+}
+
+void vnc_init_state(VncState *vs)
+{
+    VncDisplay *vd = vs->vd;
+
     vga_hw_update();
 
     vnc_write(vs, "RFB 003.008\n", 12);
     vnc_flush(vs);
     vnc_read_when(vs, protocol_version, 12);
     reset_keys(vs);
-    if (vs->vd->lock_key_sync)
-        vs->led = qemu_add_led_event_handler(kbd_leds, vs);
-
-    vs->mouse_mode_notifier.notify = check_pointer_type_change;
-    qemu_add_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
-
-    vnc_init_timer(vd);
 
     /* vs might be free()ed here */
 }