qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] vnc: Use async notifications for closing down m


From: Amit Shah
Subject: [Qemu-devel] [PATCH 2/2] vnc: Use async notifications for closing down messages
Date: Tue, 20 Jan 2009 16:11:06 +0530

If "notify vnc on" is issued on the monitor, VNC close events will be
shown on the monitor, prefixed with the '#' character.

Signed-off-by: Amit Shah <address@hidden>
---
 qemu/console.h |    3 ++-
 qemu/monitor.c |    7 +++++--
 qemu/vnc.c     |    4 ++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/qemu/console.h b/qemu/console.h
index 0cf575c..9b04b51 100644
--- a/qemu/console.h
+++ b/qemu/console.h
@@ -292,7 +292,8 @@ void curses_display_init(DisplayState *ds, int full_screen);
 /* x_keymap.c */
 extern uint8_t _translate_keycode(const int key);
 
-#define MAX_ASYNC_EVENTS  0
+#define VNC_ASYNC_EVENT   1
+#define MAX_ASYNC_EVENTS  VNC_ASYNC_EVENT
 
 /* FIXME: term_printf et al should probably go elsewhere so everything
    does not need to include console.h  */
diff --git a/qemu/monitor.c b/qemu/monitor.c
index ef871d0..a581e52 100644
--- a/qemu/monitor.c
+++ b/qemu/monitor.c
@@ -234,7 +234,10 @@ static void do_notify_async_events(char *event_str, char 
*enable)
 {
     int event;
 
-    return;
+    if (!strcmp(event_str, "vnc"))
+        event = VNC_ASYNC_EVENT;
+    else
+        return;
 
     if (!strcmp(enable, "on"))
         async_printable_events[event] = 1;
@@ -1550,7 +1553,7 @@ static const term_cmd_t term_cmds[] = {
       "target", "request VM to change it's memory allocation (in MB)" },
     { "set_link", "ss", do_set_link, "name [up|down]" },
     { "notify", "ss", do_notify_async_events,
-      "NULL on|off", "enable / disable printing of notifications for the 
specified event" },
+      "vnc on|off", "enable / disable printing of notifications for the 
specified event" },
     { NULL, NULL, },
 };
 
diff --git a/qemu/vnc.c b/qemu/vnc.c
index 17ea9a2..ad52d74 100644
--- a/qemu/vnc.c
+++ b/qemu/vnc.c
@@ -746,6 +746,8 @@ static int vnc_client_io_error(VncState *vs, int ret, int 
last_errno)
        vs->wiremode = VNC_WIREMODE_CLEAR;
 #endif /* CONFIG_VNC_TLS */
         audio_del(vs);
+        if (vs->display)
+            term_printf_async(VNC_ASYNC_EVENT, "VNC: Closing down connection 
%s\n", vs->display);
        return 0;
     }
     return ret;
@@ -2261,6 +2263,8 @@ void vnc_display_close(DisplayState *ds)
     vs->x509verify = 0;
 #endif
     audio_del(vs);
+    if (vs->display)
+        term_printf_async(VNC_ASYNC_EVENT, "VNC: Closing down connection 
%s\n", vs->display);
 }
 
 int vnc_display_password(DisplayState *ds, const char *password)
-- 
1.6.0.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]