From 8f4f3b2de0a5288fd6b68219f7ec0e2073f5017e Mon Sep 17 00:00:00 2001 From: Christian Fuchs Date: Mon, 19 May 2014 12:58:06 +0000 Subject: [PATCH] - adapted nat-tests for API changes - set NAT success return code to be GNUNET_OK --- src/include/gnunet_nat_lib.h | 2 +- src/nat/test_nat_mini.c | 10 ++++++++-- src/nat/test_nat_test.c | 5 ++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h index 40a5135bd..f81fe485a 100644 --- a/src/include/gnunet_nat_lib.h +++ b/src/include/gnunet_nat_lib.h @@ -77,7 +77,7 @@ enum GNUNET_NAT_FailureCode { /** * Just the default */ - GNUNET_NAT_ERROR_SUCCESS = 0, + GNUNET_NAT_ERROR_SUCCESS = GNUNET_OK, /** * `upnpc` command not found diff --git a/src/nat/test_nat_mini.c b/src/nat/test_nat_mini.c index 6fe4fd5b9..e9dab8351 100644 --- a/src/nat/test_nat_mini.c +++ b/src/nat/test_nat_mini.c @@ -45,15 +45,21 @@ static void addr_callback (void *cls, int add_remove, const struct sockaddr *addr, socklen_t addrlen, - const char *emsg) + enum GNUNET_NAT_FailureCode ret) { - fprintf (stderr, + if (GNUNET_NAT_ERROR_SUCCESS == ret) + { + fprintf (stderr, "Address changed: %s `%s' (%u bytes)\n", add_remove == GNUNET_YES ? "added" : "removed", GNUNET_a2s (addr, addrlen), (unsigned int) addrlen); + } + else + ; + //TODO: proper error handling! } diff --git a/src/nat/test_nat_test.c b/src/nat/test_nat_test.c index f66773a65..39bd6612e 100644 --- a/src/nat/test_nat_test.c +++ b/src/nat/test_nat_test.c @@ -50,10 +50,9 @@ end_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void report_success (void *cls, - int success, - const char *emsg) + enum GNUNET_NAT_FailureCode aret) { - GNUNET_assert (GNUNET_OK == success); + GNUNET_assert (GNUNET_NAT_ERROR_SUCCESS == aret); ret = 0; GNUNET_SCHEDULER_cancel (end); end = GNUNET_SCHEDULER_add_now (&end_test, NULL); -- 2.25.1