From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=38380 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8yFS-00017Y-VU for qemu-devel@nongnu.org; Thu, 21 Oct 2010 12:44:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8yFR-0001OM-DP for qemu-devel@nongnu.org; Thu, 21 Oct 2010 12:44:14 -0400 Received: from mail-qy0-f180.google.com ([209.85.216.180]:36790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8yFR-0001OF-B9 for qemu-devel@nongnu.org; Thu, 21 Oct 2010 12:44:13 -0400 Received: by qyk1 with SMTP id 1so4129671qyk.4 for ; Thu, 21 Oct 2010 09:44:12 -0700 (PDT) Message-ID: <4CC06DDC.9010302@codemonkey.ws> Date: Thu, 21 Oct 2010 11:44:12 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH]: VNC: set listener socket to non-blocking mode References: <1287677919.12843.4383.camel@qabil.uk.xensource.com> In-Reply-To: <1287677919.12843.4383.camel@qabil.uk.xensource.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gianni Tedesco Cc: "qemu-devel@nongnu.org" On 10/21/2010 11:18 AM, Gianni Tedesco wrote: > This prevents qemu from hanging waiting for a client to connect. I have > reproduced this when doing a loadvm but it may be a more general problem > in that poll/accept may race if a client aborts the connection with a > RST before the accept has completed. In either case the fix seems > harmless. > > Signed-off-by: Gianni Tedesco > I'd feel a little better with explicit error handling in the accept() path and a comment explaining why this was necessary. But otherwise, nice catch! Regards, Anthony Liguori > diff --git a/ui/vnc.c b/ui/vnc.c > index 864342e..172b988 100644 > --- a/ui/vnc.c > +++ b/ui/vnc.c > @@ -2736,5 +2736,6 @@ int vnc_display_open(DisplayState *ds, const char *display) > vs->display = dpy; > } > } > + socket_set_nonblock(vs->lsock); > return qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_read, NULL, vs); > } > > > >