From: Chuck Lever Date: Mon, 29 Jun 2009 16:43:26 +0000 (-0400) Subject: clnt_dg: Fix infinite loop when datagram call times out X-Git-Tag: libtirpc-0-2-1-rc2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5b14fb4f37220a31a8d483cb507ac6e7d89d84d;p=libtirpc clnt_dg: Fix infinite loop when datagram call times out 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 Signed-off-by: Steve Dickson --- diff --git a/src/clnt_dg.c b/src/clnt_dg.c index 2eeaada..2f870b1 100644 --- a/src/clnt_dg.c +++ b/src/clnt_dg.c @@ -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;