Reset the record lenght and received bytes once a record

is finished. This fixes clients doing two RPCs over the
same connection at the same time. Without this fix, we
could end with a reply to old data.

Submitted by:	Frank van der Linden <fvdl@netbsd.org>
Reviewed by:	rwatson
Obtained from:	NetBSD
This commit is contained in:
Martin Blapp 2003-01-27 22:19:32 +00:00
parent 091e0b14d5
commit 40525d3deb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109950

View File

@ -609,6 +609,7 @@ __xdrrec_getrec(xdrs, statp, expectdata)
rstrm->fbtbc = rstrm->in_reclen;
rstrm->in_boundry = rstrm->in_base + rstrm->in_reclen;
rstrm->in_finger = rstrm->in_base;
rstrm->in_reclen = rstrm->in_received = 0;
*statp = XPRT_MOREREQS;
return TRUE;
}
@ -686,6 +687,14 @@ get_input_bytes(rstrm, addr, len)
{
size_t current;
if (rstrm->nonblock) {
if (len > (int)(rstrm->in_boundry - rstrm->in_finger))
return FALSE;
memcpy(addr, rstrm->in_finger, (size_t)len);
rstrm->in_finger += len;
return TRUE;
}
while (len > 0) {
current = (size_t)((long)rstrm->in_boundry -
(long)rstrm->in_finger);