From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPE2X-0003bR-Jx for qemu-devel@nongnu.org; Tue, 20 Jan 2009 05:41:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPE2W-0003aI-MZ for qemu-devel@nongnu.org; Tue, 20 Jan 2009 05:41:00 -0500 Received: from [199.232.76.173] (port=45406 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPE2W-0003Zq-0E for qemu-devel@nongnu.org; Tue, 20 Jan 2009 05:41:00 -0500 Received: from mx2.redhat.com ([66.187.237.31]:46335) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPE2V-0005bB-Aq for qemu-devel@nongnu.org; Tue, 20 Jan 2009 05:40:59 -0500 From: Amit Shah Date: Tue, 20 Jan 2009 16:11:06 +0530 Message-Id: <1232448066-32209-2-git-send-email-amit.shah@redhat.com> In-Reply-To: <1232448066-32209-1-git-send-email-amit.shah@redhat.com> References: <1232448066-32209-1-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] vnc: Use async notifications for closing down messages Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: Amit Shah , qemu-devel@nongnu.org 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 --- 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