mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
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:
committed by
Gustavo Henrique Nihei
parent
f0372dde6a
commit
2873f33bc4
+13
-4
@@ -359,6 +359,7 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc,
|
|||||||
{
|
{
|
||||||
uint32_t mark;
|
uint32_t mark;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
int offset = 0;
|
||||||
|
|
||||||
/* Receive the record marking(RM) for stream only */
|
/* Receive the record marking(RM) for stream only */
|
||||||
|
|
||||||
@@ -388,12 +389,20 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc,
|
|||||||
resplen = mark;
|
resplen = mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = psock_recv(&rpc->rc_so, reply, resplen, 0);
|
do
|
||||||
if (error < 0)
|
|
||||||
{
|
{
|
||||||
ferr("ERROR: psock_recv response failed: %d\n", error);
|
error = psock_recv(&rpc->rc_so, reply + offset, resplen, 0);
|
||||||
return error;
|
|
||||||
|
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;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user