gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet-gtk] branch master updated: properly clean up NAT t


From: gnunet
Subject: [GNUnet-SVN] [gnunet-gtk] branch master updated: properly clean up NAT tests, implement timeout, lower timeout to 2s
Date: Thu, 16 Feb 2017 15:10:02 +0100

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

grothoff pushed a commit to branch master
in repository gnunet-gtk.

The following commit(s) were added to refs/heads/master by this push:
     new e4f73d6a properly clean up NAT tests, implement timeout, lower timeout 
to 2s
e4f73d6a is described below

commit e4f73d6a9ad4320737e0c95864ae2a65529d1c41
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Feb 16 15:11:02 2017 +0100

    properly clean up NAT tests, implement timeout, lower timeout to 2s
---
 m4/ltsugar.m4                           |  7 ++--
 src/setup/gnunet-setup-options.c        | 19 ++--------
 src/setup/gnunet-setup-transport-test.c | 65 +++++++++++++++++++++++++++++++--
 3 files changed, 68 insertions(+), 23 deletions(-)

diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
index 48bc9344..9000a057 100644
--- a/m4/ltsugar.m4
+++ b/m4/ltsugar.m4
@@ -1,7 +1,6 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
-# Foundation, Inc.
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 # Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -34,7 +33,7 @@ m4_define([_lt_join],
 # ------------
 # Manipulate m4 lists.
 # These macros are necessary as long as will still need to support
-# Autoconf-2.59, which quotes differently.
+# Autoconf-2.59 which quotes differently.
 m4_define([lt_car], [[$1]])
 m4_define([lt_cdr],
 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
@@ -45,7 +44,7 @@ m4_define([lt_unquote], $1)
 
 # lt_append(MACRO-NAME, STRING, [SEPARATOR])
 # ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
 # Note that neither SEPARATOR nor STRING are expanded; they are appended
 # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
 # No SEPARATOR is output if MACRO-NAME was previously undefined (different
diff --git a/src/setup/gnunet-setup-options.c b/src/setup/gnunet-setup-options.c
index 996a45be..c7db6c64 100644
--- a/src/setup/gnunet-setup-options.c
+++ b/src/setup/gnunet-setup-options.c
@@ -556,7 +556,7 @@ highlight_port_collisions (const void *cls,
   if (NULL == conflict_provider)
   {
     conflict_provider = gtk_css_provider_new ();
-    
+
     gtk_css_provider_load_from_data (conflict_provider,
                                     ".conflict {\n color: rgba(255, 0.0, 0.0, 
255);\n}",
                                     -1,
@@ -648,7 +648,7 @@ validate_v4_policy (const void *cls,
     if (NULL == invalid_syntax_provider)
     {
       invalid_syntax_provider = gtk_css_provider_new ();
-      
+
       gtk_css_provider_load_from_data (invalid_syntax_provider,
                                       ".syntax_error {\n color: rgba(255, 0.0, 
0.0, 255);\n}",
                                       -1,
@@ -795,7 +795,7 @@ load_option_list (const void *cls,
  * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
  */
 static int
-save_option_list (const void *cls, 
+save_option_list (const void *cls,
                  const char *section,
                  const char *option,
                   GObject * widget,
@@ -1715,19 +1715,6 @@ const struct GNUNET_SETUP_OptionSpecification 
option_specifications[] = {
    NULL },
 
   {
-   "GNUNET_setup_transport_disable_ipv6_checkbutton",
-   "toggled",
-   "nat",
-   "DISABLEV6",
-   gettext_noop ("Disable IPv6 support"),
-   "https://gnunet.org/configuration-ipv6";,
-   &load_yes_no,
-   &save_yes_no, NULL,
-   NULL, NULL,
-   NULL,
-   },
-
-  {
    "GNUNET_setup_transport_udp_port_spinbutton",
    "value-changed",
    "transport-udp",
diff --git a/src/setup/gnunet-setup-transport-test.c 
b/src/setup/gnunet-setup-transport-test.c
index f351ddf5..dd2f5674 100644
--- a/src/setup/gnunet-setup-transport-test.c
+++ b/src/setup/gnunet-setup-transport-test.c
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2010, 2011, 2014 GNUnet e.V.
+     Copyright (C) 2010, 2011, 2014, 2017 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -30,9 +30,13 @@
 /**
  * How long do we wait for the NAT test to report success?
  */
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
 
 
+/**
+ * Data structure we keep for NAT tests that run asynchronously until
+ * #TIMEOUT or shutdown.
+ */
 struct TestContext
 {
 
@@ -42,6 +46,16 @@ struct TestContext
   struct GNUNET_NAT_AUTO_Test *tst;
 
   /**
+   * Timeout task.
+   */
+  struct GNUNET_SCHEDULER_Task *tt;
+
+  /**
+   * Shutdown task.
+   */
+  struct GNUNET_SCHEDULER_Task *st;
+
+  /**
    * Name of widget to show on success.
    */
   const char *success_image;
@@ -61,7 +75,8 @@ struct TestContext
  * @param result #GNUNET_YES on success
  */
 static void
-display_test_result (struct TestContext *tc, int result)
+display_test_result (struct TestContext *tc,
+                     int result)
 {
   GObject *w;
 
@@ -93,6 +108,41 @@ display_test_result (struct TestContext *tc, int result)
 
 
 /**
+ * Task run on timeout.
+ *
+ * @param cls the `struct TestContext`
+ */
+static void
+timeout_task (void *cls)
+{
+  struct TestContext *tc = cls;
+
+  tc->tt = NULL;
+  GNUNET_SCHEDULER_cancel (tc->st);
+  tc->st = NULL;
+  display_test_result (tc,
+                       GNUNET_SYSERR);
+}
+
+
+/**
+ * Task run on shutdown.
+ *
+ * @param cls the `struct TestContext`
+ */
+static void
+shutdown_task (void *cls)
+{
+  struct TestContext *tc = cls;
+
+  tc->st = NULL;
+  GNUNET_SCHEDULER_cancel (tc->tt);
+  GNUNET_NAT_AUTO_test_stop (tc->tst);
+  GNUNET_free (tc);
+}
+
+
+/**
  * Function called by NAT on success.
  * Clean up and update GUI (with success).
  *
@@ -105,6 +155,10 @@ result_callback (void *cls,
 {
   struct TestContext *tc = cls;
 
+  GNUNET_SCHEDULER_cancel (tc->tt);
+  tc->tt = NULL;
+  GNUNET_SCHEDULER_cancel (tc->st);
+  tc->st = NULL;
   display_test_result (tc,
                        (GNUNET_NAT_ERROR_SUCCESS == result)
                        ? GNUNET_OK
@@ -137,6 +191,11 @@ GNUNET_setup_transport_test (const char *section_name,
   gtk_widget_hide (w);
   GNUNET_assert (NULL != cfg);
   GNUNET_RESOLVER_connect (cfg);
+  tc->tt = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+                                         &timeout_task,
+                                         tc);
+  tc->st = GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                          tc);
   tc->tst = GNUNET_NAT_AUTO_test_start (cfg,
                                         proto,
                                         section_name,

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



reply via email to

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