Diff between 9f9d1bc9ae4eb742590d39909cc5769b66649633 and fe8b3bda77b38e27fb3a27b589dd403855f902b6
Changed Files
| File | Additions | Deletions | Status |
| tools/mesh-gatt/gatt.c | +6 | -1 | modified |
Full Patch
diff --git a/tools/mesh-gatt/gatt.c b/tools/mesh-gatt/gatt.c
index bff5947..1bd9868 100644
--- a/tools/mesh-gatt/gatt.c
+++ b/tools/mesh-gatt/gatt.c
@@ -416,7 +416,7 @@ 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;
@@ -431,6 +431,11 @@ static bool sock_read(struct io *io, bool prov, void *user_data)
net_data_ready(res, len_sar);
}
}
+
+ /* When socket is orderly closed, then recvmsg returns 0 */
+ if (len == 0)
+ return false;
+
return true;
}