aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-11 05:57:20 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-11 05:57:20 +0000
commit86418a44da7ca7769b6b8c2bd34293b212c01af2 (patch)
tree300f1e27c2a05c490863a9389db44d2b6596c5b7 /src/peerinfo
parenta2793a97cff0c1ac4cf0c20c9a45f6e0705410f2 (diff)
downloadgnunet-86418a44da7ca7769b6b8c2bd34293b212c01af2.tar.gz
gnunet-86418a44da7ca7769b6b8c2bd34293b212c01af2.zip
-fix log level, logging, indentation
Diffstat (limited to 'src/peerinfo')
-rw-r--r--src/peerinfo/test_peerinfo_shipped_hellos.c70
1 files changed, 39 insertions, 31 deletions
diff --git a/src/peerinfo/test_peerinfo_shipped_hellos.c b/src/peerinfo/test_peerinfo_shipped_hellos.c
index db61777b0..a7475c5ab 100644
--- a/src/peerinfo/test_peerinfo_shipped_hellos.c
+++ b/src/peerinfo/test_peerinfo_shipped_hellos.c
@@ -19,7 +19,7 @@
19*/ 19*/
20 20
21/** 21/**
22 * @file peerinfo/test_peerinfo_api.c 22 * @file peerinfo/test_peerinfo_shipped_hellos.c
23 * @brief testcase for shipped HELLOs getting parsed 23 * @brief testcase for shipped HELLOs getting parsed
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @author Matthias Wachs 25 * @author Matthias Wachs
@@ -40,17 +40,21 @@ static int global_ret;
40 40
41static int 41static int
42addr_cb (void *cls, 42addr_cb (void *cls,
43 const struct GNUNET_HELLO_Address *address, 43 const struct GNUNET_HELLO_Address *address,
44 struct GNUNET_TIME_Absolute expiration) 44 struct GNUNET_TIME_Absolute expiration)
45{; 45{
46 int *addr = cls; 46 int *addr = cls;
47 (*addr) ++; 47
48 return GNUNET_OK; 48 (*addr) ++;
49 return GNUNET_OK;
49} 50}
50 51
52
51static void 53static void
52process (void *cls, const struct GNUNET_PeerIdentity *peer, 54process (void *cls,
53 const struct GNUNET_HELLO_Message *hello, const char *err_msg) 55 const struct GNUNET_PeerIdentity *peer,
56 const struct GNUNET_HELLO_Message *hello,
57 const char *err_msg)
54{ 58{
55 static unsigned int calls = 0; 59 static unsigned int calls = 0;
56 int addr; 60 int addr;
@@ -62,30 +66,34 @@ process (void *cls, const struct GNUNET_PeerIdentity *peer,
62 } 66 }
63 if (NULL != peer) 67 if (NULL != peer)
64 { 68 {
65 addr = 0; 69 addr = 0;
66 if (NULL != hello) 70 if (NULL != hello)
67 { 71 {
68 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &addr_cb, &addr); 72 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &addr_cb, &addr);
69 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got information about peer `%s' with %u addresses \n", 73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
70 GNUNET_i2s (peer), addr); 74 "Got information about peer `%s' with %u addresses \n",
71 calls++; 75 GNUNET_i2s (peer), addr);
72 } 76 calls++;
73 else 77 }
74 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Fail: Got information about peer `%s' without HELLO \n", 78 else
75 GNUNET_i2s (peer)); 79 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
80 "Fail: Got information about peer `%s' without HELLO \n",
81 GNUNET_i2s (peer));
76 } 82 }
77 else 83 else
78 { 84 {
79 if (0 == calls) 85 if (0 == calls)
80 { 86 {
81 fprintf (stderr, "Failed: %u callbacks\n", calls); 87 fprintf (stderr,
82 global_ret = 1; 88 "Failed: got no callbacks!\n");
83 } 89 global_ret = 1;
84 else 90 }
85 { 91 else
86 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got %u callbacks\n", calls); 92 {
87 global_ret = 0; 93 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
88 } 94 "Got %u callbacks\n", calls);
95 global_ret = 0;
96 }
89 } 97 }
90} 98}
91 99
@@ -107,7 +115,7 @@ int
107main (int argc, char *argv[]) 115main (int argc, char *argv[])
108{ 116{
109 global_ret = 3; 117 global_ret = 3;
110 if (0 != GNUNET_TESTING_service_run ("test_peerinfo_system_hellos", 118 if (0 != GNUNET_TESTING_service_run ("test_peerinfo_shipped_hellos",
111 "peerinfo", 119 "peerinfo",
112 "test_peerinfo_api_data.conf", 120 "test_peerinfo_api_data.conf",
113 &run, NULL)) 121 &run, NULL))