From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQXqL-0006NM-Gp for qemu-devel@nongnu.org; Fri, 22 Jul 2016 06:38:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQXqH-0005Xc-Nf for qemu-devel@nongnu.org; Fri, 22 Jul 2016 06:38:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQXqH-0005XW-FV for qemu-devel@nongnu.org; Fri, 22 Jul 2016 06:38:05 -0400 Date: Fri, 22 Jul 2016 11:38:00 +0100 From: "Daniel P. Berrange" Message-ID: <20160722103800.GQ20567@redhat.com> Reply-To: "Daniel P. Berrange" References: <1469097213-26441-1-git-send-email-caoj.fnst@cn.fujitsu.com> <1469097213-26441-3-git-send-email-caoj.fnst@cn.fujitsu.com> <5790DF51.8030806@redhat.com> <20160721153953.GJ13528@redhat.com> <5791F6A3.5090706@cn.fujitsu.com> <20160722103022.GP20567@redhat.com> <5791F8E7.3050506@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5791F8E7.3050506@cn.fujitsu.com> Subject: Re: [Qemu-devel] [PATCH 2/2] util/qemu-sockets: shoot unix_nonblocking_connect() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin Cc: Eric Blake , qemu-devel@nongnu.org, Paolo Bonzini , Gerd Hoffmann On Fri, Jul 22, 2016 at 06:43:51PM +0800, Cao jin wrote: > > > On 07/22/2016 06:30 PM, Daniel P. Berrange wrote: > > On Fri, Jul 22, 2016 at 06:34:11PM +0800, Cao jin wrote: > > > Hi Daniel > > > > > > On 07/21/2016 11:39 PM, Daniel P. Berrange wrote: > > > > On Thu, Jul 21, 2016 at 08:42:25AM -0600, Eric Blake wrote: > > > > > On 07/21/2016 04:33 AM, Cao jin wrote: > > > > > > It is never used, and now all connect is nonblocking via > > > > > > inet_connect_addr(). > > > > > > > > > > > > > > > > Could be squashed with 1/2. In fact, if you squash it, I'd title the patch: > > > > > > > > > > util: Drop unused *_nonblocking_connect() functions > > > > > > > > > > You may also want to call out which commit id rendered the functions unused. > > > > > > > > Well once those two functions are dropped the only other place accepting > > > > NonBlockingConnectHandler is the socket_connect() method. Since nearly > > > > everything is converted to QIOChannel now, there's only one caller of > > > > socket_connect() left, and that's net/socket.c > > > > > > > > Any newly written code which needs a non-blocking connect should use the > > > > QIOChannel code, so I don't see any further usage of socket_connect() > > > > being added. > > > > > > > > IOW, we can rip out NonBlockingConnectHandler as a concept entirely, not > > > > merely drop the *_nonblocking_connect() methods. > > > > > > > > > > I don't quite follow the "rip out NonBlockingConnectHandler" thing. > > > According what I learned from code, we offered non-blocking connection > > > mechanism, but it seems nobody use it(all callers of socket_connect() set > > > callback as NULL), so, do you mean removing this mechanism? > > > > Yes, remove it all, as it is no longer needed. > > > > Thanks for clarifying. Actually, I am still curious why nobody want to use > this mechanism, is there any disadvantage? And why this mechanism is > introduced in As mentioned previously it is obsolete as all new code will use the QIOChannel APIs which already provide non-blocking connect in a different manner. The qemu-sockets non-blocking code never worked properly in the first place because it calls getaddrinfo() which blocks on DNS lookups. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|