All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] meshctl: Retry recvmsg if data is not ready
@ 2019-05-21 20:03 Steve Brown
  2019-05-24  8:50 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Brown @ 2019-05-21 20:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Steve Brown

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] meshctl: Retry recvmsg if data is not ready
  2019-05-21 20:03 [PATCH v2] meshctl: Retry recvmsg if data is not ready Steve Brown
@ 2019-05-24  8:50 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2019-05-24  8:50 UTC (permalink / raw)
  To: Steve Brown; +Cc: linux-bluetooth

Hi Steve,

On Tue, May 21, 2019 at 11:29 PM Steve Brown <sbrown@ewol.com> wrote:
>
> 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

Applied, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-24  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 20:03 [PATCH v2] meshctl: Retry recvmsg if data is not ready Steve Brown
2019-05-24  8:50 ` Luiz Augusto von Dentz

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.