meshctl: Retry recvmsg if data is not ready
PATCH v2 1/1 meshctl: Retry recvmsg if data is not ready
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(-)
tools/mesh/gatt.c +4 -1
@@ -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);
Signature · 1 line
2.20.1
Hi Steve,
Quoted 28 lines · 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 messagetools/mesh/gatt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/mesh/gatt.c +4
-2@@ -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); --
Quoted 1 line
2.20.1
Applied, thanks.
Signature · 1 line
Luiz Augusto von Dentz