summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Jansa <djansa@redhat.com>2006-02-08 16:43:55 +0000
committerNathan Straz <nstraz@redhat.com>2008-09-23 09:37:45 -0400
commit8ee2fbe0cdf8a03ae041eaffc2042d072f5b237d (patch)
tree2e2d7398a0003bdc3ed9e21e086015ca7932dc5c
parentbd81fc6b03f2487050a2eebd7106f7416e178705 (diff)
downloadqarsh-8ee2fbe0cdf8a03ae041eaffc2042d072f5b237d.tar.gz
qarsh-8ee2fbe0cdf8a03ae041eaffc2042d072f5b237d.tar.xz
qarsh-8ee2fbe0cdf8a03ae041eaffc2042d072f5b237d.zip
Bail out if our recvfrom fails due to alarm or error -- client side resends requests so no need to retry in server
-rw-r--r--btimed.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/btimed.c b/btimed.c
index 0a3b609..ee758d6 100644
--- a/btimed.c
+++ b/btimed.c
@@ -45,6 +45,13 @@ main(int argc, char **argv)
nbytes = recvfrom(sd, &inmsg, BTIME_MSGLEN, MSG_WAITALL,
(struct sockaddr *)&cli_addr, &cli_addr_len);
+ if (nbytes < 0) {
+ /* Bail, we may have had an alarm(), or other error.
+ * client side resends request, no need to retry here.
+ */
+ exit(0);
+ }
+
sendto(sd, &outmsg, BTIME_MSGLEN, MSG_DONTWAIT,
(struct sockaddr *)&cli_addr, cli_addr_len);
/* We want to exit after 30 seconds of inactivity */