gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29402 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r29402 - gnunet/src/util
Date: Wed, 18 Sep 2013 19:50:19 +0200

Author: grothoff
Date: 2013-09-18 19:50:19 +0200 (Wed, 18 Sep 2013)
New Revision: 29402

Modified:
   gnunet/src/util/resolver_api.c
Log:
-avoid forever increasing backoffs on reconnect in normal operation

Modified: gnunet/src/util/resolver_api.c
===================================================================
--- gnunet/src/util/resolver_api.c      2013-09-18 17:38:39 UTC (rev 29401)
+++ gnunet/src/util/resolver_api.c      2013-09-18 17:50:19 UTC (rev 29402)
@@ -206,15 +206,14 @@
     return;
   }
   i = 0;
-  while (loopback[i] != NULL)
+  while (NULL != loopback[i])
     if (0 == strcasecmp (loopback[i++], hostname))
     {
       GNUNET_free (hostname);
       return;
     }
   LOG (GNUNET_ERROR_TYPE_ERROR,
-       _
-       ("Must specify `%s' or numeric IP address for `%s' of `%s' in 
configuration!\n"),
+       _("Must specify `%s' or numeric IP address for `%s' of `%s' in 
configuration!\n"),
        "localhost", "HOSTNAME", "resolver");
   GNUNET_free (hostname);
   GNUNET_assert (0);
@@ -250,12 +249,12 @@
     GNUNET_CLIENT_disconnect (client);
     client = NULL;
   }
-  if (r_task != GNUNET_SCHEDULER_NO_TASK)
+  if (GNUNET_SCHEDULER_NO_TASK != r_task)
   {
     GNUNET_SCHEDULER_cancel (r_task);
     r_task = GNUNET_SCHEDULER_NO_TASK;
   }
-  if (s_task != GNUNET_SCHEDULER_NO_TASK)
+  if (GNUNET_SCHEDULER_NO_TASK != s_task)
   {
     GNUNET_SCHEDULER_cancel (s_task);
     s_task = GNUNET_SCHEDULER_NO_TASK;
@@ -333,8 +332,9 @@
   struct GNUNET_RESOLVER_RequestHandle *rh = cls;
   uint16_t size;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving response from DNS service\n");
-  if (msg == NULL)
+  LOG (GNUNET_ERROR_TYPE_DEBUG, 
+       "Receiving response from DNS service\n");
+  if (NULL == msg)
   {
     char buf[INET6_ADDRSTRLEN];
 
@@ -347,7 +347,7 @@
            _("Timeout trying to resolve hostname `%s'.\n"),
            (const char *) &rh[1]);
     /* check if request was canceled */
-    if (rh->was_transmitted != GNUNET_SYSERR)
+    if (GNUNET_SYSERR != rh->was_transmitted)
     {
       if (NULL != rh->name_callback)
       {
@@ -582,10 +582,12 @@
  * Task executed on system shutdown.
  */
 static void
-shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls,
+              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   s_task = GNUNET_SCHEDULER_NO_TASK;
   GNUNET_RESOLVER_disconnect ();
+  backoff = GNUNET_TIME_UNIT_MILLISECONDS;
 }
 
 
@@ -633,6 +635,7 @@
   {
     GNUNET_CLIENT_disconnect (client);
     client = NULL;
+    GNUNET_break (0);
     reconnect ();
     return;
   }
@@ -654,11 +657,13 @@
     return;                     /* no work pending */
   if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
     return;
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to connect to DNS service\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Trying to connect to DNS service\n");
   client = GNUNET_CLIENT_connect ("resolver", resolver_cfg);
   if (NULL == client)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to connect, will try again later\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+        "Failed to connect, will try again later\n");
     reconnect ();
     return;
   }
@@ -914,7 +919,9 @@
                   "gethostname");
     return NULL;
   }
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "Resolving our hostname `%s'\n", hostname);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Resolving our hostname `%s'\n", 
+       hostname);
   return GNUNET_RESOLVER_ip_get (hostname, af, timeout, callback, cls);
 }
 




reply via email to

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