Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6118408pxb; Tue, 16 Feb 2021 17:10:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOlTjqudCmbcukTKQse+/FnWzfovE1358YlKQ+uveZGp3tSYM1NzYDmV3ysRNX6a6SgR9q X-Received: by 2002:a17:906:a405:: with SMTP id l5mr4047270ejz.107.1613524216482; Tue, 16 Feb 2021 17:10:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613524216; cv=none; d=google.com; s=arc-20160816; b=d90L2JCfHHispvATLoS0JI3qh9TKCQpQijFyyEkbX/NKckp5Tz6rHZBLhN40afOxLe S3RQCtkZO8Y81wNQnkFOF4SzoSZbLeT77SkVOe+EBFiu7IjNayFjvZRnTEprsO+255Pw Qgck8yZnBTnHBff2ekgJQXox+D7w/AJxsrF8BCfGgiW5Zyuh6R0xr6B4PjhbGk2PgfAO rRSdhZ72/jUd9ZHpuz+3vKVUAfAff7rv+GNHcSXSBhUpW8SqE/O4BSHpWJ3QMiPGri2f Qr6uxjG5O/ClvJ2yU4K7RZtlCXw6sjtpXYqXCjjnmsGSCpX1OdM5xLvCTVtGi7LuGvcf ufIw== 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=McBDHmfkfwbeBj/qAUK5UpWvbsYXc1zDEYxrt+U7x6s=; b=ZSisBgIl1DOzGCeyblPUOKHNccWPPvMc7gcF8eB1ZCHpKQUQt4SlRpAId4kvRWS81i KEsJmbHETZkq9TrXBeQmTF5xQGdSwuuV8o881mCBRVQqcVeA+bKgMPYmUhf5tcEOcQh/ DSzngPNaawp4J9hyFklHK6X+D7klwYnrA+RjRSgRMcbbwCGJW6jhAbIO6WIawLW0TwgM UYvZk+0EyBQ+UQl6Yg9hPPR8uQMJEbMC6ZfOIbgIZqckl7PQDJ+yruCI7alNDv98Vi9X OFnsBC8oPnWKeDAiCneQXdzC1WauZIZC0jnD0MqlSobz9yzMAYok59vdlirGhagc+V4X w94g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MP1MX2Kv; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k27si438315eje.568.2021.02.16.17.09.52; Tue, 16 Feb 2021 17:10:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MP1MX2Kv; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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 S230225AbhBPXeV (ORCPT + 99 others); Tue, 16 Feb 2021 18:34:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbhBPXeU (ORCPT ); Tue, 16 Feb 2021 18:34:20 -0500 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FCCEC061574 for ; Tue, 16 Feb 2021 15:33:40 -0800 (PST) Received: by mail-pf1-x42a.google.com with SMTP id t29so7177480pfg.11 for ; Tue, 16 Feb 2021 15:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=McBDHmfkfwbeBj/qAUK5UpWvbsYXc1zDEYxrt+U7x6s=; b=MP1MX2KvM5iRmDte6BSi5gnm8lPjuoj2qkkynbp17ijG+kE1PFqly7JgLUyqQhe5ZQ 8JWwXB/lFCvh6Cc6TWS2ewyxpx0m/8E+Ib+LiSYlhGQ4dfdHq5uz1wUYsdaEh6g5p+JN +wlSXLhP+AmE3LppfeQuvHZ3zXBmdnMkGaId+7qyaELho9Qm1e0QKLjfU/YBvhTOgBC1 gzIvbuwmkUwT7nmiHtNzM/o/VeOnWmmthubmSdDp01GCIDPszR62w0wN78yG+5IhgZT0 GiS0R/PLlxQxSboh4sl+N5w7a7wD5CdZmf8DohjfAdNqVKXbEMg6FnKITjbAYmo4U+in tG4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=McBDHmfkfwbeBj/qAUK5UpWvbsYXc1zDEYxrt+U7x6s=; b=i8S9IB+cFnbk8l0/AaS/L7eQ/udx7nSvSL6nVpPdEXWRCoeejDaw/8PJdp+wzjnT+r RWBHRr1uNC0d8n4KqQRW7fy9kFynN8ap3acAd50/LwodYKk8cP7rtoR+vUm0hEvSHkPm zas1gkbLD5bztpoRZqPrJALhr+ppGT0w6C3Z3J9MqVGukE3934SldiwcHTGQH6JquRLk zVG7lHlf/XL+XDxa5wc0kAQxzymnS/OnDYLgchduhyTTnlai+PBn/4U/QqmzEEdAy9g0 e2ktTM8OT3eTzDPUloFF2SmTBToKHMbwwSc3F2P5ZxWLbjWCr7bCm5lbyI4PfZaVrXtJ arcg== X-Gm-Message-State: AOAM530BFO5/na5Q3KRSpddiRAle4Q0J+GX3feMzOWCvNh4uKUqDaaBs m6uh7/omlxDyQc5LDZBRT5bX11EQ8LtbGA== X-Received: by 2002:a63:1826:: with SMTP id y38mr21258223pgl.252.1613518418917; Tue, 16 Feb 2021 15:33:38 -0800 (PST) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h5sm99956pgv.87.2021.02.16.15.33.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 15:33:38 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 1/3] avdtp: Fix setting disconnect timer when there is no local endpoints Date: Tue, 16 Feb 2021 15:33:35 -0800 Message-Id: <20210216233337.859955-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz If there are not local endpoints left there is no point in starting the disconnect timer as without any endpoint it is not possible to configure streams anymore so the code should proceed to disconnect immediately. --- profiles/audio/avdtp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index fa72ef66a..9ddcd6464 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -1226,7 +1226,13 @@ void avdtp_unref(struct avdtp *session) switch (session->state) { case AVDTP_SESSION_STATE_CONNECTED: - set_disconnect_timer(session); + /* Only set disconnect timer if there are local endpoints + * otherwise disconnect immediately. + */ + if (queue_isempty(session->lseps)) + connection_lost(session, ECONNRESET); + else + set_disconnect_timer(session); break; case AVDTP_SESSION_STATE_CONNECTING: connection_lost(session, ECONNABORTED); -- 2.29.2