aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-transport.c
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2014-06-08 15:26:55 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2014-06-08 15:26:55 +0000
commita860f03c736a43edf67bd9166eccbae2a553991d (patch)
tree38cb578fe47ccab77d62b13b5b2f103fc51c7e53 /src/transport/gnunet-transport.c
parentbddb39798942db2d4a1603487ebbc13d6f5c60bd (diff)
downloadgnunet-a860f03c736a43edf67bd9166eccbae2a553991d.tar.gz
gnunet-a860f03c736a43edf67bd9166eccbae2a553991d.zip
- moved timeout handling responsibility from for nat tests from caller to the library
- updated NAT API accordingly - removed obsolete timeout handling code from gnunet-transport - updated result callback for nat-test gnunet-transport to not always just report success, but we now actually report the proper result code we got from the NAT API - updated nat tests
Diffstat (limited to 'src/transport/gnunet-transport.c')
-rw-r--r--src/transport/gnunet-transport.c28
1 files changed, 3 insertions, 25 deletions
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 85f97e04c..edc253dae 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -537,8 +537,8 @@ display_test_result (struct TestContext *tc, enum TestResult result)
537} 537}
538 538
539/** 539/**
540 * Function called by NAT on success. 540 * Function called by NAT to report the outcome of the nat-test.
541 * Clean up and update GUI (with success). 541 * Clean up and update GUI.
542 * 542 *
543 * @param cls test context 543 * @param cls test context
544 * @param success currently always #GNUNET_OK 544 * @param success currently always #GNUNET_OK
@@ -551,23 +551,6 @@ result_callback (void *cls, enum GNUNET_NAT_FailureCode result)
551 display_test_result (tc, result); 551 display_test_result (tc, result);
552} 552}
553 553
554/**
555 * Function called if NAT failed to confirm success.
556 * Clean up and update GUI (with failure).
557 *
558 * @param cls test context
559 * @param tc scheduler callback
560 */
561static void
562fail_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
563{
564 struct TestContext *tstc = cls;
565
566 tstc->tsk = GNUNET_SCHEDULER_NO_TASK;
567 display_test_result (tstc, NAT_TEST_TIMEOUT);
568}
569
570
571static void 554static void
572resolve_validation_address (const struct GNUNET_PeerIdentity *id, 555resolve_validation_address (const struct GNUNET_PeerIdentity *id,
573 const struct GNUNET_HELLO_Address *address, 556 const struct GNUNET_HELLO_Address *address,
@@ -751,13 +734,8 @@ run_nat_test ()
751 (0 == strcasecmp (head->name, "udp")) ? GNUNET_NO : GNUNET_YES, 734 (0 == strcasecmp (head->name, "udp")) ? GNUNET_NO : GNUNET_YES,
752 (uint16_t) head->bnd_port, 735 (uint16_t) head->bnd_port,
753 (uint16_t) head->adv_port, 736 (uint16_t) head->adv_port,
737 TIMEOUT,
754 &result_callback, head); 738 &result_callback, head);
755 if (NULL == head->tst)
756 {
757 display_test_result (head, NAT_TEST_FAILED_TO_START);
758 return;
759 }
760 head->tsk = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &fail_timeout, head);
761} 739}
762 740
763 741