aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo/perf_peerinfo_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-06 01:12:57 +0000
commit9fac6b6eefdc9144053f736fd388cb2199a97046 (patch)
tree82740a981b7f6ae973d915aa77797acd9db668b2 /src/peerinfo/perf_peerinfo_api.c
parent23d8d343d5c70481ecf78ec4fafc698907f3e8a9 (diff)
downloadgnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.tar.gz
gnunet-9fac6b6eefdc9144053f736fd388cb2199a97046.zip
-removing legacy ifdefs, fixing log statements
Diffstat (limited to 'src/peerinfo/perf_peerinfo_api.c')
-rwxr-xr-xsrc/peerinfo/perf_peerinfo_api.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c
index 1492e0789..8ad79b5b5 100755
--- a/src/peerinfo/perf_peerinfo_api.c
+++ b/src/peerinfo/perf_peerinfo_api.c
@@ -53,12 +53,11 @@ static int
53check_it (void *cls, const struct GNUNET_HELLO_Address *address, 53check_it (void *cls, const struct GNUNET_HELLO_Address *address,
54 struct GNUNET_TIME_Absolute expiration) 54 struct GNUNET_TIME_Absolute expiration)
55{ 55{
56#if DEBUG
57 if (addrlen > 0) 56 if (addrlen > 0)
58 { 57 {
59 FPRINTF (stderr, "name: %s, addr: %s\n", tname, (const char *) addr); 58 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
59 "name: %s, addr: %s\n", tname, (const char *) addr);
60 } 60 }
61#endif
62 return GNUNET_OK; 61 return GNUNET_OK;
63} 62}
64 63
@@ -107,17 +106,8 @@ static void
107process (void *cls, const struct GNUNET_PeerIdentity *peer, 106process (void *cls, const struct GNUNET_PeerIdentity *peer,
108 const struct GNUNET_HELLO_Message *hello, const char *err_msg) 107 const struct GNUNET_HELLO_Message *hello, const char *err_msg)
109{ 108{
110 if (peer == NULL) 109 if (NULL != peer)
111 { 110 {
112#if DEBUG
113 FPRINTF (stderr, "Process received NULL response\n");
114#endif
115 }
116 else
117 {
118#if DEBUG
119 FPRINTF (stderr, "Processed a peer\n");
120#endif
121 numpeers++; 111 numpeers++;
122 if (0 && (hello != NULL)) 112 if (0 && (hello != NULL))
123 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &check_it, NULL); 113 GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &check_it, NULL);
@@ -153,11 +143,7 @@ check ()
153 char *const argv[] = { "perf-peerinfo-api", 143 char *const argv[] = { "perf-peerinfo-api",
154 "-c", 144 "-c",
155 "test_peerinfo_api_data.conf", 145 "test_peerinfo_api_data.conf",
156#if DEBUG_PEERINFO
157 "-L", "DEBUG",
158#else
159 "-L", "ERROR", 146 "-L", "ERROR",
160#endif
161 NULL 147 NULL
162 }; 148 };
163#if START_SERVICE 149#if START_SERVICE
@@ -169,11 +155,7 @@ check ()
169 proc = 155 proc =
170 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-peerinfo", 156 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-peerinfo",
171 "gnunet-service-peerinfo", 157 "gnunet-service-peerinfo",
172#if DEBUG_PEERINFO
173 "-L", "DEBUG",
174#else
175 "-L", "ERROR", 158 "-L", "ERROR",
176#endif
177 "-c", "test_peerinfo_api_data.conf", NULL); 159 "-c", "test_peerinfo_api_data.conf", NULL);
178#endif 160#endif
179 GNUNET_assert (NULL != proc); 161 GNUNET_assert (NULL != proc);
@@ -191,7 +173,6 @@ check ()
191 GNUNET_OS_process_wait (proc); 173 GNUNET_OS_process_wait (proc);
192 GNUNET_OS_process_close (proc); 174 GNUNET_OS_process_close (proc);
193 proc = NULL; 175 proc = NULL;
194
195#endif 176#endif
196 return ok; 177 return ok;
197} 178}
@@ -203,11 +184,7 @@ main (int argc, char *argv[])
203 int ret = 0; 184 int ret = 0;
204 185
205 GNUNET_log_setup ("perf_peerinfo_api", 186 GNUNET_log_setup ("perf_peerinfo_api",
206#if DEBUG_PEERINFO
207 "DEBUG",
208#else
209 "ERROR", 187 "ERROR",
210#endif
211 NULL); 188 NULL);
212 ret = check (); 189 ret = check ();
213 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-peerinfo"); 190 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-peerinfo");