All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Brown <sbrown@ewol.com>
To: linux-bluetooth@vger.kernel.org
Cc: Steve Brown <sbrown@ewol.com>
Subject: [PATCH v2] meshctl: Retry recvmsg if data is not ready
Date: Tue, 21 May 2019 16:03:13 -0400	[thread overview]
Message-ID: <20190521200313.11487-1-sbrown@ewol.com> (raw)

Commit d6eec1b67d6d ("meshctl: Switch from write to sendmsg for Acquire*")
causes a regression by returning an error if recvmsg has no data available.
Fix it by retrying until data is received.
---
Changes in v2:
  * Reword commit message
 tools/mesh/gatt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/mesh/gatt.c b/tools/mesh/gatt.c
index 2269a20cf..0a942d4eb 100644
--- a/tools/mesh/gatt.c
+++ b/tools/mesh/gatt.c
@@ -415,8 +415,11 @@ static bool sock_read(struct io *io, bool prov, void *user_data)
 	msg.msg_iovlen = 1;
 
 	while ((len = recvmsg(fd, &msg, MSG_DONTWAIT))) {
-		if (len <= 0)
+		if (len <= 0) {
+			if (errno == EAGAIN)
+				break;
 			return false;
+		}
 
 		res = buf;
 		len_sar = mesh_gatt_sar(&res, len);
-- 
2.20.1


             reply	other threads:[~2019-05-21 20:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 20:03 Steve Brown [this message]
2019-05-24  8:50 ` [PATCH v2] meshctl: Retry recvmsg if data is not ready Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190521200313.11487-1-sbrown@ewol.com \
    --to=sbrown@ewol.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.