You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/09/01 00:09:30 UTC
[incubator-nuttx] branch master updated: net/usrsock: allow usrsock *DATA_ACK with no-preload data
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 5d4c774352 net/usrsock: allow usrsock *DATA_ACK with no-preload data
5d4c774352 is described below
commit 5d4c774352ec353d6b44f18b30b3dc0572f5be46
Author: chao an <an...@xiaomi.com>
AuthorDate: Wed Aug 31 22:36:00 2022 +0800
net/usrsock: allow usrsock *DATA_ACK with no-preload data
allow usrsock USRSOCK_MESSAGE_RESPONSE_DATA_ACK with no-preload data
so addrlen could be updated to valuelen_nontrunc of usrsock_message_datareq_ack_s
nsh> usrsocktest
...
Testing group "basic_getsockname" =>
[TEST ASSERT FAILED!]
In function "basic_getsockname_open":
line 170: Assertion `(ssize_t)((ret)) == (ssize_t)((0))' failed.
got value: -1
should be: 0
Group "basic_getsockname": [FAILED]
Signed-off-by: chao an <an...@xiaomi.com>
---
net/usrsock/usrsock_dev.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/net/usrsock/usrsock_dev.c b/net/usrsock/usrsock_dev.c
index c3155754da..251b54373b 100644
--- a/net/usrsock/usrsock_dev.c
+++ b/net/usrsock/usrsock_dev.c
@@ -851,23 +851,26 @@ static ssize_t usrsockdev_write(FAR struct file *filep,
/* Copy data from user-space. */
- ret = iovec_put(conn->resp.datain.iov, conn->resp.datain.iovcnt,
- conn->resp.datain.pos, buffer, len);
- if (ret < 0)
+ if (len != 0)
{
- /* Tried writing beyond buffer. */
+ ret = iovec_put(conn->resp.datain.iov, conn->resp.datain.iovcnt,
+ conn->resp.datain.pos, buffer, len);
+ if (ret < 0)
+ {
+ /* Tried writing beyond buffer. */
- ret = -EINVAL;
- conn->resp.result = -EINVAL;
- conn->resp.datain.pos =
- conn->resp.datain.total;
- }
- else
- {
- conn->resp.datain.pos += ret;
- buffer += ret;
- len -= ret;
- ret = origlen - len;
+ ret = -EINVAL;
+ conn->resp.result = -EINVAL;
+ conn->resp.datain.pos =
+ conn->resp.datain.total;
+ }
+ else
+ {
+ conn->resp.datain.pos += ret;
+ buffer += ret;
+ len -= ret;
+ ret = origlen - len;
+ }
}
if (conn->resp.datain.pos == conn->resp.datain.total)