From c27e3935db4cac135dbd290c1a5ace4c272049b1 Mon Sep 17 00:00:00 2001 From: Gleb Natapov <gleb@redhat.com> Date: Wed, 24 Jun 2009 18:52:58 +0300 Subject: [PATCH 1/3] make vnc socket non-blocking QEMU event loop main_loop_wait() can be called recursively (main_loop_wait()->tcp_chr_read_poll()->do_change_vnc()->monitor_readline()->main_loop_wait()) and because of this an io callback can be called more then once for single IO event. That is why the callback can't assume that file is readable or writable and should always mark it as no-blocking and handle EAGAIN error. Upstream status: the recursion does not exists in upstream any more. Signed-off-by: Gleb Natapov <gleb@redhat.com> Message-ID: <20090624155258.GH20289@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Bugzilla: 507880 RH-Upstream-status: not-applicable Acked-by: Juan Quintela <quintela@redhat.com> Acked-by: Glauber Costa <glommer@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> --- qemu/vnc.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/qemu/vnc.c b/qemu/vnc.c index e0ce4cf..e72609d 100644 --- a/qemu/vnc.c +++ b/qemu/vnc.c @@ -2694,6 +2694,7 @@ int vnc_display_open(DisplayState *ds, const char *display) } else { free(vs->display); vs->display = dpy; + socket_set_nonblock(vs->lsock); } } return qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_read, NULL, vs); -- 1.6.3.rc4.29.g8146