-improve indentation, reduce duplication of PIDs in core's neighbour map
[oweals/gnunet.git] / src / nat / nat_auto.c
index 5b40857afa8a5f5cb877aa87501b55b355d0328a..327970e0afae473c807360fca28832eaf838f2fe 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2012 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2012 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -129,7 +129,7 @@ struct GNUNET_NAT_AutoHandle
   /**
    * Task identifier for the timeout.
    */
-  GNUNET_SCHEDULER_TaskIdentifier task;
+  struct GNUNET_SCHEDULER_Task * task;
 
   /**
    * Where are we in the test?
@@ -144,7 +144,7 @@ struct GNUNET_NAT_AutoHandle
   /**
    * Error code for better debugging and user feedback
    */
-  enum GNUNET_NAT_FailureCode ret;
+  enum GNUNET_NAT_StatusCode ret;
 };
 
 
@@ -167,10 +167,11 @@ next_phase (struct GNUNET_NAT_AutoHandle *ah);
  */
 static void
 result_callback (void *cls,
-                 enum GNUNET_NAT_FailureCode ret)
+                 enum GNUNET_NAT_StatusCode ret)
 {
   struct GNUNET_NAT_AutoHandle *ah = cls;
-  GNUNET_NAT_test_stop (ah->tst);
+  if (GNUNET_NAT_ERROR_SUCCESS == ret)
+    GNUNET_NAT_test_stop (ah->tst);
   ah->tst = NULL;
   ah->ret = ret;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -195,7 +196,7 @@ reversal_test (void *cls,
 {
   struct GNUNET_NAT_AutoHandle *ah = cls;
 
-  ah->task = GNUNET_SCHEDULER_NO_TASK;
+  ah->task = NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
              _("Testing connection reversal with ICMP server.\n"));
   GNUNET_RESOLVER_connect (ah->cfg);
@@ -231,7 +232,7 @@ test_online (struct GNUNET_NAT_AutoHandle *ah)
 static void
 set_external_ipv4 (void *cls,
                    const struct in_addr *addr,
-                   enum GNUNET_NAT_FailureCode ret)
+                   enum GNUNET_NAT_StatusCode ret)
 {
   struct GNUNET_NAT_AutoHandle *ah = cls;
   char buf[INET_ADDRSTRLEN];
@@ -602,10 +603,10 @@ GNUNET_NAT_autoconfig_cancel (struct GNUNET_NAT_AutoHandle *ah)
     GNUNET_NAT_mini_get_external_ipv4_cancel (ah->eh);
     ah->eh = NULL;
   }
-  if (GNUNET_SCHEDULER_NO_TASK != ah->task)
+  if (NULL != ah->task)
   {
     GNUNET_SCHEDULER_cancel (ah->task);
-    ah->task = GNUNET_SCHEDULER_NO_TASK;
+    ah->task = NULL;
   }
   GNUNET_CONFIGURATION_destroy (ah->cfg);
   GNUNET_CONFIGURATION_destroy (ah->initial_cfg);