From 28bc7aa886f5dcc08099c14345c2a74eb44c1ff5 Mon Sep 17 00:00:00 2001 From: mbr Date: Mon, 27 Jan 2003 22:19:32 +0000 Subject: 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 Reviewed by: rwatson Obtained from: NetBSD --- lib/libc/xdr/xdr_rec.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/libc/xdr') 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); -- cgit v1.1