[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32979 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32979 - gnunet/src/transport |
Date: |
Wed, 9 Apr 2014 11:18:26 +0200 |
Author: wachs
Date: 2014-04-09 11:18:26 +0200 (Wed, 09 Apr 2014)
New Revision: 32979
Modified:
gnunet/src/transport/gnunet-transport.c
Log:
more information why nat tests fail
Modified: gnunet/src/transport/gnunet-transport.c
===================================================================
--- gnunet/src/transport/gnunet-transport.c 2014-04-08 14:46:06 UTC (rev
32978)
+++ gnunet/src/transport/gnunet-transport.c 2014-04-09 09:18:26 UTC (rev
32979)
@@ -39,7 +39,7 @@
* How long do we wait for the NAT test to report success?
* Should match NAT_SERVER_TIMEOUT in 'nat_test.c'.
*/
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20)
#define RESOLUTION_TIMEOUT GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 30)
#define OP_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
@@ -263,6 +263,24 @@
};
+enum TestResult
+{
+ /* NAT returned success */
+ NAT_TEST_SUCCESS = GNUNET_OK,
+
+ /* NAT returned failure */
+ NAT_TEST_FAIL = GNUNET_NO,
+
+ /* NAT returned failure while running test */
+ NAT_TEST_INTERNAL_FAIL = GNUNET_SYSERR,
+
+ /* We could not start the test */
+ NAT_TEST_FAILED_TO_START = 2,
+
+ /* We had a timeout while running the test */
+ NAT_TEST_TIMEOUT = 3,
+};
+
static struct ValidationResolutionContext *vc_head;
static struct ValidationResolutionContext *vc_tail;
@@ -455,8 +473,33 @@
* @param result #GNUNET_YES on success
*/
static void
-display_test_result (struct TestContext *tc, int result)
+display_test_result (struct TestContext *tc, enum TestResult result)
{
+ switch (result) {
+ case NAT_TEST_FAIL:
+ FPRINTF (stderr, _("Configuration for plugin `%s' did not work!\n"),
+ tc->name);
+ break;
+ case NAT_TEST_SUCCESS:
+ FPRINTF (stderr, _("Configuration for plugin `%s' did work!\n"),
+ tc->name);
+ break;
+ case NAT_TEST_INTERNAL_FAIL:
+ FPRINTF (stderr, _("Internal NAT error while running test for plugin
`%s'\n"),
+ tc->name);
+ break;
+ case NAT_TEST_FAILED_TO_START:
+ FPRINTF (stderr, _("Failed to start NAT test for plugin `%s'\n"),
+ tc->name);
+ break;
+ case NAT_TEST_TIMEOUT:
+ FPRINTF (stderr, _("Timeout while waiting for result of NAT test for
plugin `%s'\n"),
+ tc->name);
+ break;
+ default:
+ break;
+ }
+
if (GNUNET_YES != result)
{
FPRINTF (stderr, "Configuration for plugin `%s' did not work!\n",
tc->name);
@@ -518,7 +561,7 @@
struct TestContext *tstc = cls;
tstc->tsk = GNUNET_SCHEDULER_NO_TASK;
- display_test_result (tstc, GNUNET_NO);
+ display_test_result (tstc, NAT_TEST_TIMEOUT);
}
@@ -676,6 +719,10 @@
static void
run_nat_test ()
{
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Running test for plugin `%s' using bind port %u and advertised port %u
\n",
+ head->name, (uint16_t) head->bnd_port, (uint16_t) head->adv_port);
+
head->tst = GNUNET_NAT_test_start (cfg,
(0 == strcasecmp (head->name, "udp")) ? GNUNET_NO : GNUNET_YES,
(uint16_t) head->bnd_port,
@@ -683,7 +730,7 @@
&result_callback, head);
if (NULL == head->tst)
{
- display_test_result (head, GNUNET_SYSERR);
+ display_test_result (head, NAT_TEST_FAILED_TO_START);
return;
}
head->tsk = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &fail_timeout, head);
@@ -726,8 +773,7 @@
_("No port configured for plugin `%s', cannot test it\n"), tok);
continue;
}
- if (GNUNET_OK
- != GNUNET_CONFIGURATION_get_value_number (cfg, section,
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, section,
"ADVERTISED_PORT", &adv_port))
adv_port = bnd_port;
@@ -747,6 +793,12 @@
NULL, NULL, NULL,
binary,
"gnunet-service-resolver", NULL );
+ if (NULL == resolver)
+ {
+ FPRINTF (stderr, _("Failed to start resolver!\n"));
+ return;
+ }
+
GNUNET_free(binary);
GNUNET_RESOLVER_connect (cfg);
run_nat_test ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32979 - gnunet/src/transport,
gnunet <=