From patchwork Thu Dec 6 06:35:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10715303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66D6F109C for ; Thu, 6 Dec 2018 06:38:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 475D22E7F8 for ; Thu, 6 Dec 2018 06:38:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39B962E80B; Thu, 6 Dec 2018 06:38:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C37DB2E7F8 for ; Thu, 6 Dec 2018 06:38:00 +0000 (UTC) Received: from localhost ([::1]:39093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUnIN-0002Hx-6U for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Dec 2018 01:37:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUnH4-0001Js-IJ for qemu-devel@nongnu.org; Thu, 06 Dec 2018 01:36:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUnH1-0003Es-PW for qemu-devel@nongnu.org; Thu, 06 Dec 2018 01:36:38 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:34113) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gUnH1-0003BZ-G7 for qemu-devel@nongnu.org; Thu, 06 Dec 2018 01:36:35 -0500 Received: by mail-pg1-x544.google.com with SMTP id 17so10208605pgg.1 for ; Wed, 05 Dec 2018 22:36:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MV5KnfjMHiDJvr3z6fKJ2mUgqVgBbW4RRnCmmfVxATA=; b=CJnrXU318CUp6y0ZC+hvq8ss9Aga6WUtR9r6AXBPKkd+iSRn2BVdrAhmif0Fa18N4K qXCdh5yL5bDkErW93u3DmDNeWb5p+yO6cEnPQb/eIBi4j8KKxVo+e1wpnGTwnLWFxKqm mVGZKllnbXkKKZkTxdL3W+P4S0NJ8ldZIIo6ngNDOUaf9gJUVf19L7JEc8ux/ACvVwAq Ql0BjRQh9fiD4Hjz91jkG9AH6VC3q7ghwt28U5Syk0QuAdWSUuVzLCgq5mMgyfCkRur5 QrMSX/O8mY2EEvCsR7tidOrg7jRxs6A0KnljFFClybJ3NgRbzFtOxs2QMvKDJJ3x9uLd ndjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MV5KnfjMHiDJvr3z6fKJ2mUgqVgBbW4RRnCmmfVxATA=; b=sztX9AF63GIU6KJi3KQ/x+y5ED9EMYBKawLs4gDIbwb7Yat19rpLx4efQEk0JlJKDm 8s+BILspLjYC+7LDUa/EvmK38DpjRgcuHbPOXn1X7TWBGfXCrWT9I0TDByZYA9GTlVpm VCaHdl+yJnIOUWWy2ZxtGt4vNRZxlPuACsZBxIXWsjpeJTGpY/DNiP7ROFICRZHuDOvr H2n3ooyrT0vJ2wb0TFftxsw/zInmohzKOJlQ7dYR0BgCxyaxAYCOOdo5XwBuaxkX4PI7 gEFS4QHRSODGITEV8NDvYzUXvvQ+ZkYp1QU0sRpmwxK3YQV8Ce4XRBTKg1QbUIWS5IbJ /1fw== X-Gm-Message-State: AA+aEWarBsrvNdDU22ftB/b2ELFHZVZ6f6IqmGx+a/xuQqmfQpmFRURN aEa1wsA7xDqzK+HEg3c8Fi3Rorhd7UA= X-Google-Smtp-Source: AFSGD/UDkPcPsb7IGDBXm0PbJ3A7PxFS+70L9rbp7u1HDobivxiTktnS1fO4StNLTNaFPU7499tFKQ== X-Received: by 2002:a62:7f94:: with SMTP id a142mr27604606pfd.96.1544078194499; Wed, 05 Dec 2018 22:36:34 -0800 (PST) Received: from yongji-Ubuntu.internal.baidu.com ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id x186sm26175249pfb.59.2018.12.05.22.36.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 22:36:34 -0800 (PST) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, marcandre.lureau@redhat.com Date: Thu, 6 Dec 2018 14:35:47 +0800 Message-Id: <20181206063552.6701-2-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181206063552.6701-1-xieyongji@baidu.com> References: <20181206063552.6701-1-xieyongji@baidu.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH for-4.0 1/6] char-socket: Enable "wait" option for client mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji Now we attempt to connect asynchronously for "reconnect socket" during open(). But vhost-user device prefer a connected socket during initialization. That means we may still need to support sync connection during open() for the "reconnect socket". Signed-off-by: Xie Yongji Signed-off-by: Zhang Yu --- chardev/char-socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index eaa8e8b68f..f2819d52e7 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -1072,7 +1072,7 @@ static void qmp_chardev_open_socket(Chardev *chr, s->reconnect_time = reconnect; } - if (s->reconnect_time) { + if (s->reconnect_time && !is_waitconnect) { tcp_chr_connect_async(chr); } else { if (s->is_listen) { @@ -1120,7 +1120,8 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, Error **errp) { bool is_listen = qemu_opt_get_bool(opts, "server", false); - bool is_waitconnect = is_listen && qemu_opt_get_bool(opts, "wait", true); + bool is_waitconnect = is_listen ? qemu_opt_get_bool(opts, "wait", true) : + qemu_opt_get_bool(opts, "wait", false); bool is_telnet = qemu_opt_get_bool(opts, "telnet", false); bool is_tn3270 = qemu_opt_get_bool(opts, "tn3270", false); bool is_websock = qemu_opt_get_bool(opts, "websocket", false);