]> granicus.if.org Git - libtirpc/commitdiff
clnt_dg: Fix infinite loop when datagram call times out
authorChuck Lever <chuck.lever@oracle.com>
Mon, 29 Jun 2009 16:43:26 +0000 (12:43 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 29 Jun 2009 16:43:26 +0000 (12:43 -0400)
After an RPC over datagram call times out, clnt_dg_call() goes into a
loop, spamming the server with endless retransmits.  Since signals
are masked, a ^C doesn't break the loop -- the process must be KILLed.

Add missing logic to exit appropriately after the call's total time
has expired.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
src/clnt_dg.c

index 2eeaada48a81f719b799f256cc22742ff5dee8c8..2f870b1ce7c192d1df4e0cb64f154e24de6f8f66 100644 (file)
@@ -381,6 +381,10 @@ call_again:
        }
 
 send_again:
+       if (total_time <= 0) {
+               cu->cu_error.re_status = RPC_TIMEDOUT;
+               goto out;
+       }
        nextsend_time = cu->cu_wait.tv_sec * 1000 + cu->cu_wait.tv_usec / 1000;
        if (sendto(cu->cu_fd, cu->cu_outbuf, outlen, 0, sa, salen) != outlen) {
                cu->cu_error.re_errno = errno;