1
0
Fork 0
forked from nuttx/nuttx-update

fs: nfs: Fix to read a large packet in TCP mode

Summary:
- I noticed that receiving a read large packet (e.g. 2KB) in TCP
  mode does not work correctly
- Actually, rpcclnt_receive() only received up to MSS
- This commit fixes this issue

Impact:
- TCP mode only

Testing:
- Tested with Ubuntu 18.04 (x86_64)
- Tested with spresense:rndis (defconfig will be updated later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masayuki Ishikawa 2021-05-12 07:09:52 +09:00 committed by Gustavo Henrique Nihei
parent f0372dde6a
commit 2873f33bc4

View file

@ -359,6 +359,7 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc,
{
uint32_t mark;
int error = 0;
int offset = 0;
/* Receive the record marking(RM) for stream only */
@ -388,12 +389,20 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc,
resplen = mark;
}
error = psock_recv(&rpc->rc_so, reply, resplen, 0);
if (error < 0)
do
{
ferr("ERROR: psock_recv response failed: %d\n", error);
return error;
error = psock_recv(&rpc->rc_so, reply + offset, resplen, 0);
if (error < 0)
{
ferr("ERROR: psock_recv response failed: %d\n", error);
return error;
}
resplen -= error;
offset += error;
}
while (rpc->rc_sotype == SOCK_STREAM && resplen != 0);
return OK;
}