Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1929710rwb; Fri, 19 Aug 2022 11:54:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4SxWZnHIFoH/MoQhkQLnAogNn2Yyc5pc4SsPzS3lVaxH//ybg3q/oHNAPhTQggyQbmV3oY X-Received: by 2002:a17:907:72d0:b0:734:b451:c8d9 with SMTP id du16-20020a17090772d000b00734b451c8d9mr5654385ejc.272.1660935255037; Fri, 19 Aug 2022 11:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660935255; cv=none; d=google.com; s=arc-20160816; b=ptDhSJ3qufYRlJUHGtJG1xAJ2n7WO8quDdaLRq+sh3caVnnHJPqhMDrlXMniQluF4e VBXrgscLW/yIuenszGcUBIMFMkq9xkJnOu0B2mf/bbEYxHbeZIOMAVgDEvaCErxu6+LJ rSBSALjnxlYITxH6dUVbqG6+0X8xxeuUBlhQWNiusJfwuY2TCZ/X4on+spMc4wfzE97l S41sIkPJ9AaP0gKtXyFe7hzsSsoP/hJJb4bw6kZ9YULlj/ZkenYGo7OlezB+fz/0YDEo UKRJclN71SdAGODvfk5lc17146pfPlOgdcyMgYjwHqPPO8xikYaRua4iokQ4YRmuOuYp DELA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=yWIT8ELdmQ4Ipws0XHcGEno+JZbGVTnFAygeqVoNIR8=; b=edSPT9s38489+Ab/mh8vQRmZfRD9XTUNo4Up9XN1Oq/iUjOe6RW/J06qNTHCfq0GfE /N9Fp9A2Z+lwSUdhP+vXqycDNlFauKgoRHO4WxCfrolLca/LiezGXhqx+Dc4XSZyYYM5 Ek6hElLcPJMxrSGBfoLtGowKxs66e7RLsmB6r3ryLFhR0Z4L9U4KS6R4ruGt4ECBNNSn 3qBdBWdYVSs37jXT66d3ENr5OnZ5XXprf7ROsfxwifK0miwfB+SFfDhl+ZNUFYdu72iB woLDC7NXq/xRj90K6lgj9gAhjPzgHEi1J8OJvDMcjEqPwrXezrVMyf6gD4UECp89a5ko b1Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F431rgXQ; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr19-20020a170906d55300b006feb76dbd51si1929941ejc.289.2022.08.19.11.53.48; Fri, 19 Aug 2022 11:54:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=F431rgXQ; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350246AbiHSSqK (ORCPT + 99 others); Fri, 19 Aug 2022 14:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349974AbiHSSqJ (ORCPT ); Fri, 19 Aug 2022 14:46:09 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F249145F74 for ; Fri, 19 Aug 2022 11:46:08 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id y4so4859103plb.2 for ; Fri, 19 Aug 2022 11:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc; bh=yWIT8ELdmQ4Ipws0XHcGEno+JZbGVTnFAygeqVoNIR8=; b=F431rgXQRNMQhv9kYFbuKcIQUQuilDhx7GCahXZD+7xL7niByhLXJO5/3qNKpJlapJ ju88n7zEEj9sexboIwMTbE0uOAZh5/Sp9HrFO5R9u8m1sXMNpD2y7w9xijcDip5RM2UZ sp/bztZ6SBHNxeoRNRV9c2nTzborWpXiPIvXL61r/hikKpsb5adCJfGENDlp15LhDowQ 5XBHKxhaAk+PlQDrQDORf9QE0aVZYlh7MfFZ688oCKL8tKZ04EUS5KGWolsT/FVg+thf GQ95gVrk7HVldR/V/Ggt+nM8FKckNGgABCGg238VZDCFI1HUv0stoZ8mMBNNYsG3LjuV xV5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc; bh=yWIT8ELdmQ4Ipws0XHcGEno+JZbGVTnFAygeqVoNIR8=; b=RVvM6wSWg7LXt5JBLu6hzcryWLQ0keHVNZM5+g670Y/rv+niYUfffEpKCPPj0olYG3 JMmxGXOpoe/swlskWN0A/sYjZRpm7cd9nnoWg/WCSLhMPKELBcFSxkEPlPh4Mng5BWHQ 9SSdjiZkrJSo1uMElHBMILsJPRQiCTyR9SveQRbZ8AI45795ccFKubB6bYkvR2vbtG8m Es3h1AkagR1y3BT7toDZQr/DIk0UWSzEy+K6pTFyLbNoKF1e2OfqcXvv5Z6FhaX3x/n2 bJXBz5Wb4A0ZIipAN9Mgpk+2dNsHZUOiI+VfJW806/p+iuJm4CZJF/v9hj7/RWc/0EOF kXog== X-Gm-Message-State: ACgBeo38LJRJMkyyL85TnNqyawQnhFOSIiolxzI4lm0EhFdF3I93Ylr0 Z/PtptzNN/KW7KKjnGUv68Xn3J6TYk4= X-Received: by 2002:a17:902:f604:b0:172:75a4:33ea with SMTP id n4-20020a170902f60400b0017275a433eamr8481365plg.7.1660934767898; Fri, 19 Aug 2022 11:46:07 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id n10-20020a6546ca000000b0042a4612c07esm1154122pgr.39.2022.08.19.11.46.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 11:46:06 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] iso-tester: Fix using shutdown(SHUT_RDWR) Date: Fri, 19 Aug 2022 11:46:05 -0700 Message-Id: <20220819184605.19225-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz shutdown(SHUT_RDWR) results in socket being HUP immeditaly instead of waiting for Disconnect Complete event so instead just use SHUT_WR to start the disconnect procedure without causing the socket to HUP. --- tools/iso-tester.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/iso-tester.c b/tools/iso-tester.c index e4950ead7c69..5727f3055222 100644 --- a/tools/iso-tester.c +++ b/tools/iso-tester.c @@ -1185,18 +1185,18 @@ static gboolean iso_disconnected(GIOChannel *io, GIOCondition cond, static void iso_shutdown(struct test_data *data, GIOChannel *io) { - int sk, cl; + int sk; sk = g_io_channel_unix_get_fd(io); - cl = dup(sk); data->io_id[0] = g_io_add_watch(io, G_IO_HUP, iso_disconnected, data); - /* Shutdown clone fd so the original fd don't HUP immediately and - * properly wait for socket to be closed. + /* Shutdown using SHUT_WR as SHUT_RDWR cause the socket to HUP + * immediately instead of waiting for Disconnect Complete event. */ - shutdown(cl, SHUT_RDWR); - close(cl); + shutdown(sk, SHUT_WR); + + tester_print("Disconnecting..."); } static gboolean iso_connect(GIOChannel *io, GIOCondition cond, -- 2.37.2