From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lwh9S-0005Nj-J3 for qemu-devel@nongnu.org; Wed, 22 Apr 2009 14:26:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lwh9O-0005NX-0T for qemu-devel@nongnu.org; Wed, 22 Apr 2009 14:26:30 -0400 Received: from [199.232.76.173] (port=55200 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lwh9N-0005NU-NZ for qemu-devel@nongnu.org; Wed, 22 Apr 2009 14:26:25 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:37959) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lwh9N-0005mg-Ct for qemu-devel@nongnu.org; Wed, 22 Apr 2009 14:26:25 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e7.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n3MIG3cW021028 for ; Wed, 22 Apr 2009 14:16:03 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n3MIQNs7169126 for ; Wed, 22 Apr 2009 14:26:23 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n3MIOa8g006713 for ; Wed, 22 Apr 2009 14:24:37 -0400 Message-ID: <49EF614B.9000601@us.ibm.com> Date: Wed, 22 Apr 2009 13:26:19 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] PATCH: enabling TCP keepalives on VNC connections References: <49EE7E35.5050908@cisco.com> In-Reply-To: <49EE7E35.5050908@cisco.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "David S. Ahern" Cc: qemu-devel@nongnu.org David S. Ahern wrote: > Something is blocking this message from my gmail account; trying again > with this one. > > This patch enables TCP keepalives on VNC connections for linux hosts. > After 60-seconds of idle time, probes are sent every 12 seconds with the > connection resetting after 5 failed probes (ie., connection is closed if > no response received in 60-seconds). > > Signed-off-by: David Ahern > > > david > > diff --git a/vnc.c b/vnc.c > index ab1f044..7a8bbd7 100644 > --- a/vnc.c > +++ b/vnc.c > @@ -32,6 +32,12 @@ > > #define VNC_REFRESH_INTERVAL (1000 / 30) > > +#ifdef __linux__ > +#define VNC_TCP_KEEPIDLE 60 > +#define VNC_TCP_KEEPINTVL 12 > +#define VNC_TCP_KEEPCNT 5 > +#endif > Should probe in configure and make an appropriate CONFIG_. This is not necessarily a linux specific feature. > #include "vnc_keysym.h" > #include "d3des.h" > > @@ -2015,12 +2021,41 @@ static void vnc_listen_read(void *opaque) > VncDisplay *vs = opaque; > struct sockaddr_in addr; > socklen_t addrlen = sizeof(addr); > + int val; > > /* Catch-up */ > vga_hw_update(); > > int csock = accept(vs->lsock, (struct sockaddr *)&addr, &addrlen); > if (csock != -1) { > +#ifdef __linux__ > + /* best effort to enable keep alives */ > + val = 1; > + if (setsockopt(csock, SOL_SOCKET, SO_KEEPALIVE, > + &val, sizeof(val)) < 0) { > + fprintf(stderr, "VNC: failed to enable keepalives\n"); > + } > If we want to enable keep alive universally, wouldn't we also want it on the tcp: character devices? -- Regards, Anthony Liguori