masayuki2009 commented on a change in pull request #3707:
URL: https://github.com/apache/incubator-nuttx/pull/3707#discussion_r631571627
##########
File path: fs/nfs/rpc_clnt.c
##########
@@ -297,29 +299,47 @@ static int rpcclnt_socket(FAR struct rpcclnt *rpc,
in_port_t rport)
static int rpcclnt_send(FAR struct rpcclnt *rpc,
FAR void *call, int reqlen)
{
+ FAR uint8_t *pkt = NULL;
uint32_t mark;
int ret = OK;
- /* Send the record marking(RM) for stream only */
+ /* Prepare the record marking(RM) for stream only
+ * NOTE: Sending a separate packet does not work with Linux host
+ */
if (rpc->rc_sotype == SOCK_STREAM)
{
- mark = txdr_unsigned(0x80000000 | reqlen);
- ret = psock_send(&rpc->rc_so, &mark, sizeof(mark), 0);
- if (ret < 0)
+ pkt = (uint8_t *)kmm_malloc(sizeof(mark) + reqlen);
+
+ if (NULL == pkt)
{
ferr("ERROR: psock_send mark failed: %d\n", ret);
- return ret;
+ return -ENOMEM;
}
+
+ mark = txdr_unsigned(0x80000000 | reqlen);
+ memcpy(pkt, &mark, sizeof(mark));
}
- /* Send the call message
+ /* Send a RPC message
+ * For TCP, the record marking + call message will be sent
+ * For UDP, call message will be sent
*
* On success, psock_send returns the number of bytes sent;
* On failure, it returns a negated errno value.
*/
- ret = psock_send(&rpc->rc_so, call, reqlen, 0);
+ if (pkt)
+ {
+ memcpy(pkt + sizeof(mark), call, reqlen);
+ ret = psock_send(&rpc->rc_so, pkt, sizeof(mark) + reqlen, 0);
Review comment:
@xiaoxiang781216
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]