2019-05-16 09:22:25

by Steve Brown

[permalink] [raw]
Subject: [PATCH] meshctl: Retry recvmsg if data is not ready, else return error

---
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