diff options
author | mbr <mbr@FreeBSD.org> | 2003-01-27 22:19:32 +0000 |
---|---|---|
committer | mbr <mbr@FreeBSD.org> | 2003-01-27 22:19:32 +0000 |
commit | 28bc7aa886f5dcc08099c14345c2a74eb44c1ff5 (patch) | |
tree | 9624285bb009929a6271ad372a293b5d18f3836a /lib/libc/xdr | |
parent | 7995bad207f0163d48659bae4301f4b3c8ab5757 (diff) | |
download | FreeBSD-src-28bc7aa886f5dcc08099c14345c2a74eb44c1ff5.zip FreeBSD-src-28bc7aa886f5dcc08099c14345c2a74eb44c1ff5.tar.gz |
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
Diffstat (limited to 'lib/libc/xdr')
-rw-r--r-- | lib/libc/xdr/xdr_rec.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libc/xdr/xdr_rec.c b/lib/libc/xdr/xdr_rec.c index a09c496..e899ebb 100644 --- a/lib/libc/xdr/xdr_rec.c +++ b/lib/libc/xdr/xdr_rec.c @@ -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); |