qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: aliguori@us.ibm.com
Cc: Amit Shah <amit.shah@redhat.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] vnc: Use async notifications for closing down messages
Date: Tue, 20 Jan 2009 16:11:06 +0530	[thread overview]
Message-ID: <1232448066-32209-2-git-send-email-amit.shah@redhat.com> (raw)
In-Reply-To: <1232448066-32209-1-git-send-email-amit.shah@redhat.com>

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 <amit.shah@redhat.com>
---
 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	other threads:[~2009-01-20 10:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 10:41 [Qemu-devel] [PATCH 1/2] Print asynchronous notifications on request Amit Shah
2009-01-20 10:41 ` Amit Shah [this message]
2009-01-20 11:35 ` [Qemu-devel] " Jan Kiszka
2009-01-20 12:56   ` Avi Kivity
2009-01-20 13:32   ` Amit Shah
2009-01-20 15:27     ` Jan Kiszka
2009-01-20 20:42 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1232448066-32209-2-git-send-email-amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).