Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4095326ybb; Tue, 7 Apr 2020 00:15:02 -0700 (PDT) X-Google-Smtp-Source: APiQypLnFhUdND+6l3JZw2wNfcGB8gFITXNK94rZgnFzOIvWPbeX0MxDCNhN8oSLc/2rskF0LtgH X-Received: by 2002:aca:558c:: with SMTP id j134mr679533oib.102.1586243702865; Tue, 07 Apr 2020 00:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586243702; cv=none; d=google.com; s=arc-20160816; b=bI4NFne48xgtd2xVqyvBFVNFjyxN5qjNjlkl52KCN66pTM80eQynVdg/sAgT6iDon7 tG1HxbqIiVCtG+sHeyj6Lp7T8FUg/a5HlbVuqH3SYljmFxWjMYRFm17WKIqoLc4wKfUG a1GYyAJzkDK2EEUxK+Aq7Ig+9rw20ds+GmQ/YR2IZjSGJjXpbbr4DQO7MRpDW8jU5xru iWDSQcKBOHuBnkY1k/ltO+fH9QtLYckqVaK2OiP9DYB6X3P1aFN3qvOEc5026LRZE84O B792ZjhNHu19vDJXg/sypuequSuvvkmOudIp8nXOfapEOd4xig553YFftn3WJChN8Fhm LN+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:to:from :dkim-signature; bh=imYCD2xWoMVaj7Kw27rrHAjZFT8sKAu9DHj/SsA1HOk=; b=xZa2km35GmOPKsp31fhce8sReOkQG+OEIlIq83pppa5MxDI9YcZE2TK/a5B0WpvrFX P4H4vQ+ux+ImcT3dLNiDm9X0iP9a7l7VAZXZ4A/NEHFhqbOYaHU7NhIYwXXFR/XR01Ot 0AHgVJaBzKFnWuNAUt3rIFSHgqKtzCDLME6wmPd2KphlhPPv92MeZo8SO5M+B/WjKq9s 8vi8SzjHto+aUV7n/pg0p8pXNNTpYIE5UjYTXOduOXwhRpsIUYL1s2RTQspNMyG3Qwoo mo4CBvEyeV+4F4GKZ//VigrtZ848JZ/g9bf0IMT79zla767y2PPJ+menWnJOtA8bVmIZ 1RUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b=P2EiccST; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a11si299666oib.154.2020.04.07.00.14.41; Tue, 07 Apr 2020 00:15:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b=P2EiccST; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726808AbgDGHOR (ORCPT + 99 others); Tue, 7 Apr 2020 03:14:17 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:43333 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727187AbgDGHOR (ORCPT ); Tue, 7 Apr 2020 03:14:17 -0400 Received: by mail-lf1-f65.google.com with SMTP id k28so1500065lfe.10 for ; Tue, 07 Apr 2020 00:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codecoup-pl.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:organization:in-reply-to:references :mime-version:content-transfer-encoding; bh=imYCD2xWoMVaj7Kw27rrHAjZFT8sKAu9DHj/SsA1HOk=; b=P2EiccSTeFc6AWgnniUy+ULImwxrAazApq2z2KTH7F8MsyuL9fHyh3+HdtKL+UVQc6 hUMPF9Yy0Kd4Ls8tepoXB7zrZIxYZxuwuFpRvtqyqe4rcimkBxFtQe5iWdH2VzS9JCYc 6nXFgTuUXwe0F0PqrzfvXpAWLVlCklULeGVtv7f/DJWf+Fvn5hfIR08FBvPCJnlkD1jK nSmyHdEsywo92KGShVkcgbOyOmc7VTDp7bNeWT7VSsJWvIVtq/lhWmiGMPkdntanE9NK yPcHX7cAUNWNgA4DuG6yOXCO+HnENI1bPuAj4MS+VxPUhzSdicnn9+WULXhGyqHF//RU h0RA== 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:organization :in-reply-to:references:mime-version:content-transfer-encoding; bh=imYCD2xWoMVaj7Kw27rrHAjZFT8sKAu9DHj/SsA1HOk=; b=Cw+7Kwtf+wWsXDxBy6d52ZQCuSgUeCEGQ3fwD7mDMjJ9UtIiw1vjcsPrG6n3i/Ho0M x7S0fVxRk+YiMACKuMsFF2nGvJkOwBvpLQLS335IBXW3aF3Cqi7jrEqC/mMmr6wdzm+V s54nt8MOR8cdeqk/QXZtrJ+VoktzuAcFjN9lavzxUgAKsI4XCjOT4V9TCCBlB5d07YW/ YF8uILa+cAVn4aMlCTSuv3h7sbqOu1BrHT/ijXl2eMRGV/db5YPILXa/fhz2nv2eAjAm 77dfGjMewWWIByTzA171nfPQJExHfAuaYOpI0v2wKjLqIQJOKZvlBQiQZBmVtFw14wa3 u/2w== X-Gm-Message-State: AGi0PuaFMF/OI1pX+s1/uvLjmOmEiIggEwghe4Rz2A32eGKyanARgozR CwOgDOMXUCOV5iySeFO/nuP9du6/QlE= X-Received: by 2002:a05:6512:14a:: with SMTP id m10mr619026lfo.152.1586243654432; Tue, 07 Apr 2020 00:14:14 -0700 (PDT) Received: from ix.localnet (45-11-60-42.ip4.greenlan.pl. [45.11.60.42]) by smtp.gmail.com with ESMTPSA id p21sm11156527ljg.5.2020.04.07.00.14.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 00:14:13 -0700 (PDT) From: Szymon Janc To: linux-bluetooth@vger.kernel.org Subject: Re: [PATCH] gatt: Fix AcquireWrite and AcquireNotify server support Date: Tue, 07 Apr 2020 09:14:13 +0200 Message-ID: <2834426.nXdnVRqWta@ix> Organization: CODECOUP In-Reply-To: <20200407012906.166736-1-szymon.janc@codecoup.pl> References: <20200407012906.166736-1-szymon.janc@codecoup.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Tuesday, 7 April 2020 03:29:06 CEST Szymon Janc wrote: > Register read handler only for notify IO and handle socket > disconnection in sock_io_read. > --- > src/gatt-database.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/src/gatt-database.c b/src/gatt-database.c > index 483c84341..92e24e5f7 100644 > --- a/src/gatt-database.c > +++ b/src/gatt-database.c > @@ -2358,7 +2358,7 @@ static bool sock_io_read(struct io *io, void > *user_data) ssize_t bytes_read; > > bytes_read = read(fd, buf, sizeof(buf)); > - if (bytes_read < 0) > + if (bytes_read <= 0) > return false; > > send_notification_to_devices(chrc->service->app->database, > @@ -2379,8 +2379,6 @@ static struct io *sock_io_new(int fd, void *user_data) > > io_set_close_on_destroy(io, true); > > - io_set_read_handler(io, sock_io_read, user_data, NULL); > - > io_set_disconnect_handler(io, sock_hup, user_data, NULL); > > return io; > @@ -2537,6 +2535,7 @@ static void acquire_notify_reply(DBusMessage *message, > void *user_data) DBG("AcquireNotify success: fd %d MTU %u\n", fd, mtu); > > chrc->notify_io = sock_io_new(fd, chrc); > + io_set_read_handler(chrc->notify_io, sock_io_read, chrc, NULL); > > __sync_fetch_and_add(&chrc->ntfy_cnt, 1); Applied. -- pozdrawiam Szymon Janc