gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: fix immediate retry


From: gnunet
Subject: [gnunet] branch master updated: fix immediate retry
Date: Sun, 10 May 2020 00:52:39 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new cf765197c fix immediate retry
cf765197c is described below

commit cf765197cf9c67ab408f9a42834122c813998884
Author: Martin Schanzenbach <address@hidden>
AuthorDate: Sun May 10 00:47:38 2020 +0200

    fix immediate retry
---
 src/gns/nss/nss_gns_query.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index af5c91b72..11e46ad7f 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -60,15 +60,16 @@ gns_resolve_name (int af, const char *name, struct userdata 
*u)
   FILE *p;
   char line[128];
   int ret;
+  int retry = 0;
   int out[2];
   pid_t pid;
 
   if (0 == getuid ())
     return -2; /* GNS via NSS is NEVER for root */
-  if (0 != pipe (out))
-    return -1;
 
 query_gns:
+  if (0 != pipe (out))
+    return -1;
   pid = fork ();
   if (-1 == pid)
     return -1;
@@ -140,21 +141,23 @@ query_gns:
   }
   (void) fclose (p);
   waitpid (pid, &ret, 0);
-
   if (! WIFEXITED (ret))
     return -1;
   if (4 == WEXITSTATUS (ret))
     return -2; /* not for GNS */
   if (5 == WEXITSTATUS (ret))
-    goto restart_arm; /* timeout -> try restart */
+  {
+    if (1 == retry)
+      return -2; /* no go -> service unavailable */
+    retry = 1;
+    system("gnunet-arm -s");
+    goto query_gns; /* Try again */
+  }
   if (3 == WEXITSTATUS (ret))
     return -2; /* timeout -> service unavailable */
   if ((2 == WEXITSTATUS (ret)) || (1 == WEXITSTATUS (ret)))
     return -2; /* launch failure -> service unavailable */
   return 0;
-restart_arm:
-  system("gnunet-arm -s");
-  goto query_gns;
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]