From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQY9t-0005XR-Am for qemu-devel@nongnu.org; Fri, 22 Jul 2016 06:58:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQY9o-0001Lf-85 for qemu-devel@nongnu.org; Fri, 22 Jul 2016 06:58:20 -0400 Received: from [59.151.112.132] (port=45024 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQY9n-0001Km-SG for qemu-devel@nongnu.org; Fri, 22 Jul 2016 06:58:16 -0400 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> <20160722103800.GQ20567@redhat.com> From: Cao jin Message-ID: <5791FDF6.3000501@cn.fujitsu.com> Date: Fri, 22 Jul 2016 19:05:26 +0800 MIME-Version: 1.0 In-Reply-To: <20160722103800.GQ20567@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit 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: "Daniel P. Berrange" Cc: Eric Blake , qemu-devel@nongnu.org, Paolo Bonzini , Gerd Hoffmann On 07/22/2016 06:38 PM, Daniel P. Berrange wrote: > 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. > Aha! I see! And also I see the comment you left in the code: /* socket_connect() does a non-blocking connect(), but it * still blocks in DNS lookups, so we must use a thread */ Thanks very much, and I think maybe I can do this cleanup work:) > Regards, > Daniel > -- Yours Sincerely, Cao jin